Results 1 to 5 of 5

Thread: Runtime Error 3001 Invalid Arguement

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2015
    Posts
    2

    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;"

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2015
    Posts
    2

    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;"

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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;
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width