View Full Version : Select Only Records For Specific ID Query


fenhow
07-31-2007, 10:16 AM
This is killing me,

I have a form with a unique ID, I have a query that pulls all data regardless of the ID on the form.

How can I get the Query to pull only the data for the ID that is currently in view on the form?

Please help..

Thanks,

Fen How

pbaldy
07-31-2007, 10:27 AM
In the criteria for that field:

Forms!FormName.ControlName

Fernando
07-31-2007, 10:32 AM
Lets say your Unique ID (fldID) will be selected from a combo box (cmbID) and the query bounded to the form has fldID in it (SELECT fldID ... )

Have your combo box cmbID Unbounded and on After update event do the following:

Private Sub cmbID_AfterUpdate()
Me.Recordset.FindFirst "fldID = " & cmbID
End Sub


so each time you select an ID it will show the record for that ID.