Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help with SQL in VBA code

Status
Not open for further replies.

JARE

Technical User
Jul 27, 2000
50
US
I am trying to create a recordset that will take PkId
And find the line in ORDER_PROCESSING table with the
Same ID. this code works fine when using TEXT fields
but when removing the quotes from PkdID I get an error
("Too few parameters, expected 1") PkdID is a unbound
field on a form and ID is a field in ORDER_PROCESSING query
ID is Type AutoNumber And PkdId is type General Number.



Set MyRs = CurrentDb.OpenRecordset("SELECT * FROM [ORDER_PROCESSING] WHERE [ID] = PkdId", dbOpenDynaset, dbSeeChanges)
 
Try this:

==========
Dim strSQL as String
strSQL = "SELECT * FROM [ORDER_PROCESSING] WHERE [ID] = " & Me![PkdId]

Set MyRs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
 
Thanks That did the trick!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top