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