CopperWire
Technical User
I'm currently using a form to set the criteria in a query and I'm wondering if there is a way to do that with a module. Specifically, I want to change the CD_WR using a form. The SQL is below:
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT WRInquiry.* FROM WRInquiry Where CD_WR = Forms!RefundableForm!EnterWR;"
I tried to reference the form and field. The code failed at Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset, I get a run-tme error '3061': Too few parameters. Expected 1.
So it appears the form is not being read??. I even tried passing the variable and that didn't work.
Any ideas?
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT WRInquiry.* FROM WRInquiry Where CD_WR = Forms!RefundableForm!EnterWR;"
I tried to reference the form and field. The code failed at Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset, I get a run-tme error '3061': Too few parameters. Expected 1.
So it appears the form is not being read??. I even tried passing the variable and that didn't work.
Any ideas?