Open a report for a list query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I'm tring to write a IIF Statement to open a verity of Reports for a list
box in VBA with SQL. I can open a report, but how do I open a single report
by using a IIF statement? Help

Jeff Johnson

Example: Start

Private Sub RoyaltyReports_Click()
DoCmd.OpenReport "iAnywhere", acViewPreview, acReadOnly
DoCmd.Close acForm, "NotesSamplerVendorInformation"
End Sub
 
Not sure I understand what you're trying to do.

What's the IIf statement supposed to do?
 
What I'm tring to do is open a reports that I design from the report tab use
a IIf Statement in VBA?
 
Why do you think you need an IIf statement?

Your original question stated that you have a list box containing the names
of the reports and you want to open a selected report.

Perhaps you'd better explain in more detail what it is you're trying to
accomplish.
 
Ok, I have a list box with names of query and reports. I also have command
button that will open querys and one to open reports. The query and report I
have have different criteria filters and calculations. What I'm try to do is
be able to select a name from the field list and run the query or report.
 
If you've got a listbox lstReports that contains the names of the queries
and reports, make sure its Multiselect property is set to None. You can then
refer to Me!lstReports to get the value of the currently selected item.

Do you have someway of distinguishing which items are queries and which are
reports? Once you know the name of the query or report, how do you know what
criteria filter to use?
 
Yes, I do. I have 21 names in the list box, this names have their own
individual querys. Adobe, Microsoft, Billback, etc., Also they have there own
individual Reports too, the Report have their own names AdobeR, MicrosoftR,
BillbackR, etc. (the "R" Stands for Report). The Report are base of the
query. I have Seperate button one to Run query and one to Run Reports.
 
Back
Top