troubleshooting Question

Runtime Error 3001 - Invalid Argument error

Avatar of Zane80
Zane80Flag for New Zealand asked on
Microsoft OfficeMicrosoft AccessSQL
14 Comments3 Solutions1697 ViewsLast Modified:
When trying to run the following piece of code I get a 'Runtime Error 3001 Invalid Argument'. This code has previously worked and I cannot find any changes to it. INTRAN is an ODBC database using a dataflex driver.
Intran1 is a copy which keeps an offline backup (for faster reporting)

I have tried changing the last line to:
" WHERE ([INTRAN].[DATE] > #01/01/2011# and [INTRAN].[DATE] < #30/04/2011#);"

And I still receive the same error
strSQL = "INSERT INTO Intran1 ( [Key], RECORD_NUMBER, [INM#], WHSE, QTY, PRICE, NET, COST, DISCRATE, DISCOUNT, TAXRATE," & _
                " TAXAMOUNT, [BATCH#], SEQUENCE, BATCH, PERIOD, TRAN, REF, [DATE], DETAIL, STOCK_CODE, [STOCKCAT#]," & _
                " CATEGORY, QTY2, [NOTE], ORDER_NO, ORDER_SEQ_NO, FC_PRICE, FC_NET, FC_DISCOUNT, FC_TAXAMOUNT, FC_COST," & _
                " [@SPARE1], [@SPARE2], [@SPARE3], [@SPARE4] )" & _
            " SELECT DISTINCTROW Format([date],'yyyymmdd') & '-' & [record_number] AS [Key], INTRAN.RECORD_NUMBER," & _
                " INTRAN.[INM#], INTRAN.WHSE, INTRAN.QTY, INTRAN.PRICE, INTRAN.NET, INTRAN.COST, INTRAN.DISCRATE," & _
                " INTRAN.DISCOUNT, INTRAN.TAXRATE, INTRAN.TAXAMOUNT, INTRAN.[BATCH#], INTRAN.SEQUENCE, INTRAN.BATCH," & _
                " INTRAN.PERIOD, INTRAN.TRAN, INTRAN.REF, INTRAN.DATE, INTRAN.DETAIL, INTRAN.STOCK_CODE," & _
                " INTRAN.[STOCKCAT#], INTRAN.CATEGORY, INTRAN.QTY2, INTRAN.NOTE, INTRAN.ORDER_NO, INTRAN.ORDER_SEQ_NO," & _
                " INTRAN.FC_PRICE, INTRAN.FC_NET, INTRAN.FC_DISCOUNT, INTRAN.FC_TAXAMOUNT, INTRAN.FC_COST," & _
                " INTRAN.[@SPARE1], INTRAN.[@SPARE2], INTRAN.[@SPARE3], INTRAN.[@SPARE4]" & _
            " FROM INTRAN" & _
           " WHERE (((DateDiff('m',([INTRAN].[DATE]),Now()))<9));"
              
            
            


DoCmd.RunSQL strSQL
ASKER CERTIFIED SOLUTION
Graham Mandeno
Consultant

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros