If that's the only problem you can set the range in the DoCmd.TransferSpreadsheet to "A7:BB10000". I'm just using 10,000 as an example. Pick a number you are confident the row count won't go past. Then just run a query to delete all null records from the table.
Syntax:
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel3, "TableName", "pathtofile", True, "A7:BB10000"
Hi
Thanks for this. I tried it and get an error message which reads
error 3709 the search key was not found in any record.
I have checked the spreadsheet to ensure that all the header fields have an entry and the format is set to general for all of them.
I have pasted my code below just incase I've done something stupid and now can't see the wood for the trees.
Private Sub bImport_Click()
On Error GoTo Err_bImport_Click
Me.tbHidden.SetFocus
If IsNull(tbFile) Or tbFile = "" Then
MsgBox "Please browse and select a valid file to import.", vbCritical, "Invalid File"
Else
If Dir("C:\Wren_Jobs\") <> "" Then
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, tbFileName, tbFile, -1, "A6:BB40"
MsgBox "Imported your file into the table."
Else
MsgBox "Your computer does not have a valid file so the import will not work.", vbInformation
End If
End If
Exit_bImport_Click:
Exit Sub
Err_bImport_Click:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_bImport_Click
End Sub
Thanks once again