If then EOF Parameter Query

Boo

Registered User.
Local time
Yesterday, 16:30
Joined
Aug 30, 2004
Messages
32
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
 
Fixed why I was getting nothing.
Now I am getting 'Item not found in collection'
'bout to give up
 
qd.Parameters("[Forms]![FormName]![ControlName]") = [Forms]![FormName]![ControlName]
.
 
It works!!!!!!!!!!!!!!!
You people are soooo wonderful.
I have been working on this for a long time.
Thank you very much.

Happy
 

Users who are viewing this thread

Back
Top Bottom