I want to run a parameter query, getting the parameter from a control, on a form. Then I want to do an If Then
I have the code below on after update the control.
When I update the control, nothing happens.
Apparently there is nothing wrong with the code, just the msgbox's don't happen. Anybody willing to give me a help?
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qd As DAO.QueryDef
Set db = CurrentDb
Set qd = db.QueryDefs!QueryName
qd.Parameters![Forms]![FormName]![ControlName] = [Forms]![FormName]![ControlName]
Set rs = qd.OpenRecordset
If rs.EOF Then
MsgBox "no records"
Else
MsgBox "query has records"
End If
qd.Close
Thanks folks
I have the code below on after update the control.
When I update the control, nothing happens.
Apparently there is nothing wrong with the code, just the msgbox's don't happen. Anybody willing to give me a help?
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qd As DAO.QueryDef
Set db = CurrentDb
Set qd = db.QueryDefs!QueryName
qd.Parameters![Forms]![FormName]![ControlName] = [Forms]![FormName]![ControlName]
Set rs = qd.OpenRecordset
If rs.EOF Then
MsgBox "no records"
Else
MsgBox "query has records"
End If
qd.Close
Thanks folks