Printing for a List Box

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];
 
J

John Vinson

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...
 
J

Jeff Conrad

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
 

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