Access newbie here. I have a form with two tables for Record Sources [tbl_Composition] & [tbl_ProductRelationships], and a combobox (cmb_SelProdName) whose Row Source is a ProductName field from [tbl_ProductRelationships].
When a user selects a choice from the combobox I'd like to query [tbl_Composition] for the ProductName (they should match) and get the entire row for that product which contains information I need to feed to a report. Here's my vba for the AfterUpdate on the combobox:
Code:
Private Sub cmb_SelProdName_AfterUpdate()
Dim db As Database
Dim rec As DAO.Recordset
Dim RecQry As String
Set db = CurrentDb
RecQry = "SELECT * FROM [tbl_composition] WHERE [tbl_composition].ALLOY_DESC = " & Me.cmb_SelProdName
Set rec = db.OpenRecordset(RecQry)
End Sub
This is giving me a Variable Not Defined error when I make a selection on my combobox, and I'm a bit stuck. I'm asking myself, what does "Set db=CurrentDb" do when the form has two dependencies? Any help would be greatly appreciated.