I set a global variable in the declarations section of a form - Public PONumber as Long
Then in the click event of a command button on the form I use:
POnumber = Me![PurchaseOrderNo]
Set dbs = CurrentDb
stSql = "SELECT * FROM [InventoryTransactions]"
stSql = stSql & " WHERE [PurchaseOrderNo] = PONumber"
stSql = stSql & " ORDER BY gponumber;"
Debug.Print stSql
Set rs = dbs.OpenRecordset(stSql, dbOpenDynaset, dbSeeChanges)
The debug.print shows that the variable in the SQL is not finding the number even though
POnumber = Me![PurchaseOrderNo] is finding it
I get an error 'Too few parameters. Expected 1' when the on the set rs = ...
I guess there's something wrong with my SQL.
Can anyone help?
Thanks.
Fran
Then in the click event of a command button on the form I use:
POnumber = Me![PurchaseOrderNo]
Set dbs = CurrentDb
stSql = "SELECT * FROM [InventoryTransactions]"
stSql = stSql & " WHERE [PurchaseOrderNo] = PONumber"
stSql = stSql & " ORDER BY gponumber;"
Debug.Print stSql
Set rs = dbs.OpenRecordset(stSql, dbOpenDynaset, dbSeeChanges)
The debug.print shows that the variable in the SQL is not finding the number even though
POnumber = Me![PurchaseOrderNo] is finding it
I get an error 'Too few parameters. Expected 1' when the on the set rs = ...
I guess there's something wrong with my SQL.
Can anyone help?
Thanks.
Fran