I have the following code:
Private Sub cmdImportRanFile_Click()
strCnxn = set_connection()
Set cnxn = New ADODB.Connection
cnxn.Open strCnxn
strSQL_Execute = "dbo.Ran_BillingDelete"
cnxn.Execute strSQL_Execute, , adExecuteNoRecords
Dim dkg As Variant, str As String
dkg = Application.FileDialog(msoFileDialogFilePicker).Show
str = Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1)
DoCmd.TransferText acImportDelim, "RanBillingImportSpecificationA", "Ran_Billing", str
DoCmd.Hourglass True
strCnxn = set_connection()
Set cnxn = New ADODB.Connection
cnxn.Open strCnxn
strSQL_Execute = "dbo.Ran_BillingUpdate"
cnxn.Execute strSQL_Execute, , adExecuteNoRecords
DoCmd.Hourglass False
End Sub
The problem are is the DoCmd.TransferText statement. When the code is run I get the following error on this statement:
Runtime Error '3001': Invalid Argument.
This code runs perfectly in another database. I have inspected the import specification and compared it to the other database to ensure that they are the same and they are. I checked the references to make sure they are the same in both databases and they are. Can anyone shed some light on what I am possibly missing? Any help is appreciated. Thanks.
Private Sub cmdImportRanFile_Click()
strCnxn = set_connection()
Set cnxn = New ADODB.Connection
cnxn.Open strCnxn
strSQL_Execute = "dbo.Ran_BillingDelete"
cnxn.Execute strSQL_Execute, , adExecuteNoRecords
Dim dkg As Variant, str As String
dkg = Application.FileDialog(msoFileDialogFilePicker).Show
str = Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1)
DoCmd.TransferText acImportDelim, "RanBillingImportSpecificationA", "Ran_Billing", str
DoCmd.Hourglass True
strCnxn = set_connection()
Set cnxn = New ADODB.Connection
cnxn.Open strCnxn
strSQL_Execute = "dbo.Ran_BillingUpdate"
cnxn.Execute strSQL_Execute, , adExecuteNoRecords
DoCmd.Hourglass False
End Sub
The problem are is the DoCmd.TransferText statement. When the code is run I get the following error on this statement:
Runtime Error '3001': Invalid Argument.
This code runs perfectly in another database. I have inspected the import specification and compared it to the other database to ensure that they are the same and they are. I checked the references to make sure they are the same in both databases and they are. Can anyone shed some light on what I am possibly missing? Any help is appreciated. Thanks.