I have been trying to import Excel spreadsheets into MS Access 2013.
Then it keep producing "Type Conversion Failure" errors for a field "DOB" - date type.
I tried to change the data type of my access table for column "DOB" but there's no luck.
How can i import the table successfully without having "import errors table".
Any ideas? Thank yo uso much
The code below is the one that I used to import data into access
Code:
Private Sub cmd_YesUpdateSAP_Click()
Dim fDialog As Object
Dim SourcePath As String
Dim Success As Boolean
Dim DelReqUpdateSAPSQL As String
Dim LoadReqUpdateSAPSQL As String
On Error GoTo ErrorHandler
Set fDialog = Application.FileDialog(3)
Dim varFile As Variant
Success = False
With fDialog
.AllowMultiSelect = False
.Title = "Select excel file to import the data :"
.InitialFileName = "c:\"
If .Show = True Then
For Each varFile In .SelectedItems
SourcePath = varFile
Next
Success = True
Else
Success = False
End If
End With
If Success Then
DelReqUpdateSAPSQL = "Delete * From UPDATE_SAP"
DoCmd.RunSQL DelReqUpdateSAPSQL
DoCmd.TransferSpreadsheet acImport, 8, "UPDATE_SAP", SourcePath, True, ""
End If
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Please import the correct file!"
Me.Refresh
Resume ErrorHandlerExit
End Sub