Preview reports from a form

  • Thread starter Thread starter drgiardina
  • Start date Start date
D

drgiardina

Guest
I want to create a list/combo box on a form that will allow me to choose a report and view it. I know I need a combo box and a command button but I cannot get it to work.

I also need a step by step outline.
This is driving me crazy so any help would be greatly appreciated.

Thanks a mil
Vince
 
You will need to use the After Update event of you combo/list box to trigger the opening of the report. The example below uses a combo box, but the theory is the same for a list box.

Private Sub cboYourCombobox_AfterUpdate()
Dim strWhere As String
strWhere = "YourField =" & Me![cboYourCombobox]
DoCmd.OpenReport "YourReport", acViewPreview, , strWhere
End Sub

You will need to substitute the names "cboYourCombobox", "YourField", and "YourReport" for the actual names of your objects. Use quotes in the code as shown in the code above.

HTH
RDH
 

Users who are viewing this thread

Back
Top Bottom