Hey guys,
I have this query that nicely associates and displays information between two tables (tblAgencyInformationNew and tblProgramCodes). I turned this into a report and now working on a form where a user can select an item via dropdown. At first the user can click on a button and the filtered form would pop up however I thought it might be easier to simply use the combo box's onclick property and use a bit of vba. I looked at some previous posts and thought I'd play with some code but so far nothing has worked.
The code here is is the closest I've come and by that I mean when I make a selection I don't get any errors:
The report opens but it displays ALL the records and not the one I selected. Any thoughts?
rptAgencyProgramCodes = report based on AgencyProgramCodes query
ProgramCode = field in query ideally this report should filter by (e.g. *NOCODE, 1213, 3828, etc.)
frmPrograms = form user selects option in combo box
cboProgramCodes = name of combo box
I have this query that nicely associates and displays information between two tables (tblAgencyInformationNew and tblProgramCodes). I turned this into a report and now working on a form where a user can select an item via dropdown. At first the user can click on a button and the filtered form would pop up however I thought it might be easier to simply use the combo box's onclick property and use a bit of vba. I looked at some previous posts and thought I'd play with some code but so far nothing has worked.
The code here is is the closest I've come and by that I mean when I make a selection I don't get any errors:
Code:
Private Sub cboProgramCodes_Click()
DoCmd.OpenReport "rptAgencyProgramCodes", acViewReport, "[ProgramCode]= '" & [Forms]![frmPrograms]![cboProgramCodes] & "'"
End Sub
The report opens but it displays ALL the records and not the one I selected. Any thoughts?
rptAgencyProgramCodes = report based on AgencyProgramCodes query
ProgramCode = field in query ideally this report should filter by (e.g. *NOCODE, 1213, 3828, etc.)
frmPrograms = form user selects option in combo box
cboProgramCodes = name of combo box
Attachments
Last edited: