-
Feb 19th, 2015, 08:00 PM
#1
Thread Starter
New Member
Runtime Error 3001 Invalid Arguement
Hey All -
I am running the below SQL via VBA in Access 2003, and I getting a runtime error 3001 invalid argue. I have doubled checked that the columns exist in both tables, as well as verified the the spelling within both tables. However I cant seem to get past the error. Any assistance you can provide would be greatly appreciated. Thanks in advance.
Code:
DoCmd.RunSQL "INSERT INTO MINOUTL_Master ( [Item Nbr], ITMST, Effective, Expire, MINOUTL, Time_Stamp ) " _
& "SELECT tbl_MINOUTL_Intermediate.[Item Nbr], tbl_MINOUTL_Intermediate.ITMST, " _
& tbl_MINOUTL_Intermediate.Effective, " _
& "tbl_MINOUTL_Intermediate.Expire, tbl_MINOUTL_Intermediate.MINOUTL, tbl_MINOUTL_Intermediate.Time_Stamp " _
& "FROM tbl_MINOUTL_Intermediate;"
-
Feb 20th, 2015, 05:36 AM
#2
Re: Runtime Error 3001 Invalid Arguement
does the select part work, without the insert?
probably just a typo on posting, but you are missing a quote at the start of the 3rd line
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Feb 20th, 2015, 09:38 AM
#3
Thread Starter
New Member
Re: Runtime Error 3001 Invalid Arguement
I broke apart the select from the insert portion of the query, and it threw an error of using a valid SQL query. However, I can't find any errors in the SQL that I wrote. Below is the modification that I made to run the select portion only.
And you are correct it was a typo as the orginal code included the necessary quotation marks.
Code:
DoCmd.RunSQL "SELECT tbl_MINOUTL_Intermediate.[Item Nbr], tbl_MINOUTL_Intermediate.ITMST, " _
& "tbl_MINOUTL_Intermediate.Effective, " _
& "tbl_MINOUTL_Intermediate.Expire, tbl_MINOUTL_Intermediate.MINOUTL, tbl_MINOUTL_Intermediate.Time_Stamp " _
& "FROM tbl_MINOUTL_Intermediate;"
-
Feb 20th, 2015, 03:52 PM
#4
Re: Runtime Error 3001 Invalid Arguement
no line continuation on line 2?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Feb 20th, 2015, 04:37 PM
#5
Re: Runtime Error 3001 Invalid Arguement
Does the query run if you paste it into an access query object? If not, what is the error?
Also, DoCmd.RunSQL doesn't run SELECT statements as they return recordsets. To test it you need to you CurrentDB.Execute.
Code:
SELECT tbl_MINOUTL_Intermediate.[Item Nbr], tbl_MINOUTL_Intermediate.ITMST, tbl_MINOUTL_Intermediate.Effective, tbl_MINOUTL_Intermediate.Expire, tbl_MINOUTL_Intermediate.MINOUTL, tbl_MINOUTL_Intermediate.Time_Stamp
FROM tbl_MINOUTL_Intermediate;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|