Transferspreadsheet turn off autorecognize column type

SkiGeek

New member
Local time
Today, 12:31
Joined
Aug 22, 2007
Messages
8
Hello all,

I'm using some vba to transfer an excel spreadsheet into an existing table. Is there a way to stop the transferspreadsheet command from automatically choosing the datatype? I think this is the problem because when the first few rows of a specific column are blank I get Type Conversion Failure's but if I enter text in the first row the errors go away.

Here is the sub routine I call to transfer the spreadsheet:
Code:
'Prereq: First Row must contain column names.
Public Sub ImportExcelSheet(strFilePath As String, strSheet As String, strDestTbl As String)
    DoCmd.SetWarnings False
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, strDestTbl, strFilePath, True, strSheet & "!"
    DoCmd.SetWarnings True
    MsgBox "Excel Sheet was imported succesfully"
End Sub

Thank you
 

Users who are viewing this thread

Back
Top Bottom