Invalid Arg 3001 with SQL recordset

  • Thread starter Thread starter Andy G
  • Start date Start date
A

Andy G

All I'm trying to do is select a product from a combo box and have the cost
and quantity show up in the two boxes (txtProductCost and txtQty). The
backend is a SQL database so I think that I have to use dbSeeChanges. I'm
getting the error "Run time error 3001, Invalid Argument" on the set rs line
below. Any help would be greatly appreicated.


Dim rs As Recordset
Dim mySQL As String
mySQL = "SELECT PROD_PROD_ID, PROD_NAME, PROD_COST, PROD_QTY " & _
"FROM dbo_tblCFSPH_PROD " & _
"WHERE PROD_PROD_ID = " & Me.cmbProductName

Set rs = CurrentDb().OpenRecordset(mySQL, dbopendynaset, dbseechanges)
Me.txtProductCost = rs![PROD_COST]
Me.txtQty = rs![PROD_QTY]
rs.Close
 
Does your VBA project have a reference to the DAO object library? If this is
a copy-and-paste of the actual code, the failure of the VBA IDE to
capitalize "dbopendynaset" and "dbseechanges" would indicate that it does
not.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Back
Top