Im trying to use a query as part of a command button to have some level of data validation. This is for an orders system and if the value entered (Temp_Quantity) exceeds the remaining value (check_quantity) then I want it to stop and tell the user why.
The query itself works fine, its showing the correct numbers when im testing. I have tripple checked the name of the query and the two fields also. Any ideas on why im getting Run-time error '3061'. Too few parameters. Expected 1.?Code:Dim db As dao.Database Dim rs As dao.Recordset Set db = CurrentDb Set rs = db.OpenRecordset("Quantity_Check") rs.MoveFirst Do While Not rs.EOF If rst!check_quantity < rst!Temp_Quantity Then MsgBox "Value entered (" & rst!Temp_Quantity & ") exceeds the available order quantity" Exit Sub Else End If rs.MoveNext Loop
Thank you.