Printing for a List Box

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Hello,
I out a list box on my form "Reporter" and using the code
below from mvps.org inserted it into the row source. How
do I attach a command button to print a report that is
selected in the list box?

SELECT [Name] FROM MsysObjects WHERE (([Type]=-32764) And
([Name] Not Like "~*") And ([Name] Not Like "MSys*"))
ORDER BY [Name];
 
Hello,
I out a list box on my form "Reporter" and using the code
below from mvps.org inserted it into the row source. How
do I attach a command button to print a report that is
selected in the list box?

SELECT [Name] FROM MsysObjects WHERE (([Type]=-32764) And
([Name] Not Like "~*") And ([Name] Not Like "MSys*"))
ORDER BY [Name];

Something like

Dim strReportName As String
strReport = Me.listboxname
DoCmd.OpenReport strReport, <optional parameters>

in the AfterUpdate event of the listbox should work...
 
Thanks John! Do you know how to call the Report Builder
wizard using a command button
-----Original Message-----
Hello,
I out a list box on my form "Reporter" and using the code
below from mvps.org inserted it into the row source. How
do I attach a command button to print a report that is
selected in the list box?

SELECT [Name] FROM MsysObjects WHERE (([Type]=-32764) And
([Name] Not Like "~*") And ([Name] Not Like "MSys*"))
ORDER BY [Name];

Something like

Dim strReportName As String
strReport = Me.listboxname
DoCmd.OpenReport strReport, <optional parameters>

in the AfterUpdate event of the listbox should work...


.
 
Hi Steve,

I found this in my "stash" of Access stuff. I'm not an
expert at all, but it may be able to help you call the
Report Wizard.

For 97 version this works from a command button:
(Watch out for line wrapping, this should all be on one
line)

Application.Run "wzmain80.frui_entry", "qrySwitchboard",
acReport

For 2000 version this works:

Application.Run "Acwzmain.frui_entry", "qrySwitchboard",
acReport

This button is on a form that has qrySwitchboard as its
Record Source. I think this parameter is needed so you
need to put a table or stored query in that spot. I
think???

Hope that helps a little,
Jeff Conrad
Bend, Oregon
 
Back
Top