I have a form with a combo box that I'm using to limit data shown on another form that's data source is a select query.
Once I've selected the filter criteria on the 1st form, how do I get the query to run so that the results are displayed on the 2nd form?
This seems like Access 101 to me but I've been struggling with it for quite some time. When debugging this, if I run the query without filling in the first form, the query prompts me for the missing parameter. When I type it in, the query runs perfectly and the 2nd form displays with the correct data shown. When I use the first form to enter the criteria, the query produces a null result (the form and query are void of data).
Here's the code on the 1st form's button used to open the 2nd form:
Private Sub Open_History_Click()
On Error GoTo Err_Open_History_Click
Dim stDocName As String
stDocName = "Antibody_Lot_History"
DoCmd.OpenForm stDocName
Exit_Open_History_Click:
Exit Sub
Here's the query SQL.
SELECT Antibody_Lot_History.Antibody_Name, Antibody_Lot_History.Lot_Number, Antibody_Lot_History.Order_Date, Antibody_Lot_History.Received_Date, Antibody_Lot_History.Open_Date, Antibody_Lot_History.Exhaust_Date, Manufacturer.Manufacturer
FROM Antibody_Lot_History INNER JOIN Manufacturer ON Antibody_Lot_History.Antibody_Name = Manufacturer.Antibody_Name
WHERE (((Antibody_Lot_History.Antibody_Name)=[Forms]![Antibody_Pop-up]![Antibody_Select]));
Thanks for your help. PS - I searched the forum knowing this must be discussed but my search criteria turned up so many unrelated hits that it was impossible to wade thru them. (I tried)
Once I've selected the filter criteria on the 1st form, how do I get the query to run so that the results are displayed on the 2nd form?
This seems like Access 101 to me but I've been struggling with it for quite some time. When debugging this, if I run the query without filling in the first form, the query prompts me for the missing parameter. When I type it in, the query runs perfectly and the 2nd form displays with the correct data shown. When I use the first form to enter the criteria, the query produces a null result (the form and query are void of data).
Here's the code on the 1st form's button used to open the 2nd form:
Private Sub Open_History_Click()
On Error GoTo Err_Open_History_Click
Dim stDocName As String
stDocName = "Antibody_Lot_History"
DoCmd.OpenForm stDocName
Exit_Open_History_Click:
Exit Sub
Here's the query SQL.
SELECT Antibody_Lot_History.Antibody_Name, Antibody_Lot_History.Lot_Number, Antibody_Lot_History.Order_Date, Antibody_Lot_History.Received_Date, Antibody_Lot_History.Open_Date, Antibody_Lot_History.Exhaust_Date, Manufacturer.Manufacturer
FROM Antibody_Lot_History INNER JOIN Manufacturer ON Antibody_Lot_History.Antibody_Name = Manufacturer.Antibody_Name
WHERE (((Antibody_Lot_History.Antibody_Name)=[Forms]![Antibody_Pop-up]![Antibody_Select]));
Thanks for your help. PS - I searched the forum knowing this must be discussed but my search criteria turned up so many unrelated hits that it was impossible to wade thru them. (I tried)