Run time error 3001 Invalid Argument when using DoCmd.Transfertext

carbonfiber56

New member
Local time
Today, 12:46
Joined
Jan 4, 2013
Messages
2
I have the following VBA code:

Dim dkg As Variant, str As String
dkg = Application.FileDialog(msoFileDialogFilePicker).Show
str = Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1)

DoCmd.TransferText acImportDelim, "OnyxSRImportSpecification", "Onyx_Allocation_Import", _
str, False

Here is the data I am trying to import:

RCG,Onyx,&70670637,706JAY,359,11/17/2011,12/31/2012,12/31/2012,NO,NO

Onyx_Allocation_Import is a table in SQL Server 2008 R2 and is a linked table. The import specification is delimited using .csv. All fields in the table are Varchar(50) and the table fields in Access show up as Text.

Every time I try to import this row I get the following error message:

Run-time error '3001':

Invalid argument.

I have tried several suggestions found on Goggle with no success (setting all fields to varchar, adding false at the end of the docmd). Does anyone have any suggestions?

Thanks for any help in advance.

Dave
 
Code:
Dim dkg As Variant, str As String
    set dkg = Application.FileDialog(1)
dkg.show
    str = dkg.SelectedItems(1)
 
This still results in the same error.

Dave
 
If you are using Access 2007 or 2010, I believe you need to use the SpecID of the import specification and not the name you saved it as. To find out what it is, right click on the Navigation Pane gray area at the top of it where it shows the word TABLES if you have selected tables, etc. and select Navigation Options. Then check the Show System Objects under the Display Options. Then open the table MsysIMEXSpecs and search for your named specification and then you should see the SpecID field with the number.
 

Users who are viewing this thread

Back
Top Bottom