G
GoCoogs
Hello,
I have two combo boxes linked to two different tables (workers &
competencies). When the user selects the worker and the competency
then clicks a button I want the subform to populate from a third table
which contains the worker, the competency tested, the date tested, and
the result.
I have created a query that retrieves the information I want with
parameters setup to prompt for the worker and competency.
I want to feed the values of the combo boxes to the parameters in the
query and display the results in a subform.
The code I have does not work at all:
Private Sub Command8_Click()
Dim db As Database
Dim rs As Recordset
Dim qdfParmQry As QueryDef
Set db = CurrentDb()
Set qdfParmQry = db.QueryDefs("WorkerCompResults")
qdfParmQry("which worker do you want results for?") =
comboPharm.Value
qdfParmQry("which competency do want results for?") =
comboComp.Value
Set rs = qdfParmQry.OpenRecordset()
SubFormWorkerCompResults.Form.Recordset = rs
End Sub
SubFormWorkerCompResults is bound to the query WorkerCompResults and
the parameters prompting for worker and competency popup before the
main form opens. I've been working on this for several hours and am
close to pulling my hair out. Please help!
Thanks,
-Blake
I have two combo boxes linked to two different tables (workers &
competencies). When the user selects the worker and the competency
then clicks a button I want the subform to populate from a third table
which contains the worker, the competency tested, the date tested, and
the result.
I have created a query that retrieves the information I want with
parameters setup to prompt for the worker and competency.
I want to feed the values of the combo boxes to the parameters in the
query and display the results in a subform.
The code I have does not work at all:
Private Sub Command8_Click()
Dim db As Database
Dim rs As Recordset
Dim qdfParmQry As QueryDef
Set db = CurrentDb()
Set qdfParmQry = db.QueryDefs("WorkerCompResults")
qdfParmQry("which worker do you want results for?") =
comboPharm.Value
qdfParmQry("which competency do want results for?") =
comboComp.Value
Set rs = qdfParmQry.OpenRecordset()
SubFormWorkerCompResults.Form.Recordset = rs
End Sub
SubFormWorkerCompResults is bound to the query WorkerCompResults and
the parameters prompting for worker and competency popup before the
main form opens. I've been working on this for several hours and am
close to pulling my hair out. Please help!
Thanks,
-Blake