COmbo Box of Reports

  • Thread starter Combo Box Report list
  • Start date
C

Combo Box Report list

I'd like to know, how can I use the combo box to list ALL reports in my
database and, when I choose a particular report, it is automatically updated
based on new information in the tables?
 
C

Combo Box Report list

The report names are A,B,C. I'd like to create a list box with those names
and when I choose report A, B or C, it it automatically updated and
displayed.
 
D

Duane Hookom

I always create a table of reports with the report object name, a friendlier
report title, and possibly other information. Use this table as the Row
Source of your combo box.
 
C

Combo Box Report list

I think I understand what youre talking about, however, how do you link a
table with only the name of the reports to the reports themselves, and how
do you get them to automatically update when you select a specific table from
the combo box?
 
D

Duane Hookom

Assuming you have a table ztblReports with fields rptName, rptTitle,
rptStatus, rptDescription. The rptName field contains the actual name of the
report ie: rptProjectStatus. Your combo box would have a Row Source property
like:

SELECT rptName, rptTitle, rptDescription
FROM ztblReports
WHERE rptStatus <> 0
ORDER BY rptTitle;

Some other properties would be:
Name: cboReport
Column Widths: 0, 2, 0
Bound Column: 1
Column Count: 3

Your code to open a report would be something like:

Dim strRptName as String
If Not IsNull(Me.cboReport) Then
strRptName = Me.cboReport
DoCmd.OpenReport strRptName, acPreview
Else
Msgbox "Choose a report", vbOkOnly, "PEBKAC"
End If
 
C

Combo Box Report list

Duane,
Thank you for your input, however, this is a little over my head. Can you
recommend a book for a beginner (no programming experience) that I can refer
to so that I can learn what this code means and how to wirte it?
 
D

Duane Hookom

I would use the command button wizard to create a button that opens any
report. Then change the code generated by the wizard to use the combo box
value rather than the report name you specified with the wizard.

If you can't figure this out, reply back with your exact combo box name and
the code generated by the command button wizard.

Regarding books, check John Viescas' page
http://www.viescas.com/Info/books.htm#Visual Basic.
 
C

Combo Box Report list

I'm really trying to follow and understand what you're telling me, but it's
nor working our for me. I'm assuming that you mean VBA code when trying to
use the command button, if so, then all I have is this:

Private Sub UPDATE_REPORT_Click()

End Sub

The name of the combo box is "Report LIst."
 
C

Combo Box Report list

One more thing, I have a combo box which updates my reports based on the
information in the tables. However, I have only figured out how to use this
combo box for one report, but I have several reports that I want updated when
I choose them. When using the combo box wizard it doesn't seem to allow you
to choose all reports that you want. How do I amend this box to work like I
want it?
 
D

Duane Hookom

When I stated "button that opens any report" it was the same as when you get
prompted to "press any key". It doesn't make any difference which key you
press or which report you choose. There is no "any" report like there is no
"any" key.

I have no clue how a combo box "updates my reports". You can use a combo box
to select a report to open (like we are attempting) or possibly filter the
record source of the report.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top