Hello,
I have a VB code which grabs an excel2003 sheet and imports it into a table in my access 2007 database. My problem is when I import the sheet, 2 columns are giving me the type conversion error because my data has mixed alpha only / alpha numeric / and numeric only.
I believe the import is looking at the first record, seeing alpha and then erroring all of the numeric only records. How can I fix this? I can't alter the spreadsheet as I receive it daily, and the whole point of my VB was to save me time. Any suggestions?
Private Sub Command36_Click()
DoCmd.SetWarnings False
Dim ImportDate As String
ImportDate = InputBox("Please enter load date")
Set db = CurrentDb
Set rs = db.openrecordset("UploadDate")
With rs
'rs.Edit
rs.AddNew
rs!UploadDate = ImportDate
rs.Update
rs.Close
End With
DoCmd.OpenQuery ("Qry_Delete_TBL_RepRoster_Temp")
DoCmd.OpenQuery ("Qry_Delete_TBL_RepRoster")
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TBL_RepRoster_Temp", "S:\Magenta\Sanofi Pasteur\Sales Lead Program\Rep Rosters Archive\Field Roster " & ImportDate & ".xls", True, "A:V"
DoCmd.OpenQuery ("Qry_Append TBL_RepRoster_Temp_to_TBL_Rep_Roster")
Uploadtxtbox = " The last uploaded RepRoster was: " & ImportDate
MsgBox ("RepRoster Successfully Updated!")
DoCmd.SetWarnings True
End Sub
I don't normally do this but check out this thread:
http://www.excelforum.com/access-tab...rom-excel.html
His posted code he would like some help changing, might help you import the sheet in a different manner, possibly removing your issue.
Hope this helps,
Dan
"I am not a rocket scientist, I am a nuclear engineer." - Split_atom18
If my advice has been helpful to you, then please help me by clicking on the "Star" and adding to my reputation, Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks