error 3001

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi:

My database works fine last week, but this week when I open a form, or do
something else need to run this kind of code:
----------------------------------
strSQL = "SupplierCode = " & "'" & Me.SupplierCode & "'" 'build a SQL string.
DoCmd.OpenForm FormName:="frmProductsDataSheetView", view:=acFormDS,
whereCondition:=strSQL
---------------or----------------
strSQL = "SELECT ProductCode, NumOfPurchased, NumOfSold FROM Products Where
" _
& "ProductCode = '" & strMyProductCode & "'"
Set rst = dbs.OpenRecordset(strSQL)
---------------------------------

Will give me below error.
run-time error '3001'
Invalid argument

Why there was no problem at all to run this kind of code, but how these days
showing this? Do I miss something to update?

Really appreciate your help!

Thanks.

James
 
Try the following statement before the OpenForm or OpenRecordset statements:

Debug.Print strSQL

This will send the contents of strSQL to the immediate window. Does it look
correct? Does your data (the value for SupplierCode or strMyProductCode)
have an apostrophe in it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top