K
Kpakute via AccessMonster.com
I have a "Sold" table with the following fields. StoredID, ProductID,
Quantity. StoredID and ProductID are composite key.
I want a situation where I click a button on my form, it increases the
Quantity value by 1 for the displayed first columns of StoredID combobox
and ProductID combobox.
These combo boxes a multi-columned but are bound to the different tables.
This is the On_Click event code.
Dim D As Database
Dim Q As QueryDef
Dim strSQL As String
Set D = CurrentDb()
strSQL = "UPDATE Sold "
strSQL = strSQL & "SET Sold.Quantity = [Quantity]+1 "
strSQL = strSQL & "WHERE (((Sold.ProductID)=" & Me![ProductID] & ") AND
((Sold.BedID)=" & Me![StoreID] & "));"
MsgBox strSQL
Set Q = D.CreateQueryDef("", strSQL)
Q.Execute dbFailOnError
Anytime I run this code I keep getting,
"run-time error '3061': Too few parameters. Expected 2".
I have run the query using QBE and it does the increment. Can anyone tell
me what I'm doing wrong and help fix my problem?
Quantity. StoredID and ProductID are composite key.
I want a situation where I click a button on my form, it increases the
Quantity value by 1 for the displayed first columns of StoredID combobox
and ProductID combobox.
These combo boxes a multi-columned but are bound to the different tables.
This is the On_Click event code.
Dim D As Database
Dim Q As QueryDef
Dim strSQL As String
Set D = CurrentDb()
strSQL = "UPDATE Sold "
strSQL = strSQL & "SET Sold.Quantity = [Quantity]+1 "
strSQL = strSQL & "WHERE (((Sold.ProductID)=" & Me![ProductID] & ") AND
((Sold.BedID)=" & Me![StoreID] & "));"
MsgBox strSQL
Set Q = D.CreateQueryDef("", strSQL)
Q.Execute dbFailOnError
Anytime I run this code I keep getting,
"run-time error '3061': Too few parameters. Expected 2".
I have run the query using QBE and it does the increment. Can anyone tell
me what I'm doing wrong and help fix my problem?