Select a Report from a List

R

Robert T

I’m sure this is pretty basic to most Access veterans but I’m having a hard
time coding a report list selection. I created a Combo Box with a list of
reports such as the following:

Annual Report
Quarterly Report
New Cases
Pending Cases
Completed Cases

Once the user selects a report from the list, I would like to use a Select
Case Statement, possibly in the AfterUpdate event of the Combo Box, to
Preview the selected report. However, I’m having a hard time doing such and
would appreciate any help you could offer.

Maybe I’m going about it the wrong way. Should I have the user click on a
command button that presents a list of reports and then ????

Thanks,
Robert
 
M

Minton M

I'm sure this is pretty basic to most Access veterans but I'm having a hard
time coding a report list selection. I created a Combo Box with a list of
reports such as the following:

Annual Report
Quarterly Report
New Cases
Pending Cases
Completed Cases

Once the user selects a report from the list, I would like to use a Select
Case Statement, possibly in the AfterUpdate event of the Combo Box, to
Preview the selected report. However, I'm having a hard time doing such and
would appreciate any help you could offer.

Maybe I'm going about it the wrong way. Should I have the user click on a
command button that presents a list of reports and then ????

Thanks,
Robert

Not a problem:

1. Create your combo (I'm assume the report names are in the first
field in the combo box).
2. In the combo's after update event put:

DoCmd.OpenReport Me.MyComboName

.... and like magic the reports will open. You can fiddle with the
parameters in the OpenReport method to change preview/print, etc.

Hope this helps,
James
 
M

Marshall Barton

Robert said:
I’m sure this is pretty basic to most Access veterans but I’m having a hard
time coding a report list selection. I created a Combo Box with a list of
reports such as the following:

Annual Report
Quarterly Report
New Cases
Pending Cases
Completed Cases

Once the user selects a report from the list, I would like to use a Select
Case Statement, possibly in the AfterUpdate event of the Combo Box, to
Preview the selected report. However, I’m having a hard time doing such and
would appreciate any help you could offer.


I suggest that you create a table of report names and
descriptions and use that as the combo box row source. The
ColumnCount = 2, and BoundColumn = 1 and ColumnWidths = 0;

Then the code for a button's click event or the combo box's
after update event would just be:

DoCmd.OpenReport Me.[the como box]
 
R

Robert T

Hey Guys:

Thanks for the excellent suggestions. I'll give them a try tomorrow morning
and let you know how it works. I'm leaning towards using Marshalls'
suggestion.

Robert
 
M

Marshall Barton

Robert said:
Thanks for the excellent suggestions. I'll give them a try tomorrow morning
and let you know how it works. I'm leaning towards using Marshalls'
suggestion.


I think the only difference between our two responses is
that James assumed you already had such a table.
 
R

Robert T

Hey Guys:

Except for an annoying formatting issue, it seems to be working well. Here's
the 1 line of code I placed in the AfterUpdate event of the Combo Box.

DoCmd.OpenReport Me.cboSelectAReport, acViewPreview

Hope I did that right.

There's one reamining annoying problem. The last selected value in the Combo
Box remains visible, this may confuse the user. There must be a simple way to
clear the combo box value so it always starts out with a blank.

Thanks for your help,
Robert
 
R

Robert T

Please disregard the last request. I added one line of additional code that
apparently clears and refreshes the combo box so the user doesn't see the
previous selection displayed.

Select a Report from a List
Private Sub cboSelectAReport_AfterUpdate()
DoCmd.OpenReport Me.cboSelectAReport, acViewPreview
'Clear the Combo Box choices previously selected with the following code.
Me.cboSelectAReport = Null
End Sub
 
M

Marshall Barton

Robert said:
Please disregard the last request. I added one line of additional code that
apparently clears and refreshes the combo box so the user doesn't see the
previous selection displayed.

Select a Report from a List
Private Sub cboSelectAReport_AfterUpdate()
DoCmd.OpenReport Me.cboSelectAReport, acViewPreview
'Clear the Combo Box choices previously selected with the following code.
Me.cboSelectAReport = Null
End Sub


Exactly what I would have done.

Cross this one off the list and move
on to the next issue ;-)
 

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