By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

controling which report to print in VB

P: n/a


Hi,

I have 4 reports created in Ms-access and I will use VB to print those
reports. My problem is I'm not sure if I can control wich report to
print..

Those reports are almost the same, what is different is the logo in the
report header or page header.
Because there are 4 different logo. I want the user to choose in VB
which logo to use and then VB will print the report that the user chose.
Is that possible? I'm new in using reports so any suggestions?
Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 01 Aug 2005 03:16:11 GMT, Claudia Fong
<cd********@yahoo.co.uk> wrote:

Delete 3 reports.

Then in the Report_Open event of the remaining one, write something
like:
imgLogo.Picture = <path_to_logo>

Now how you determine which logo to print depends on the details of
your app. If it's one of 4 buttons ("print rpt 1", "print rpt 2" etc),
then it's simple. On some more recent versions of Access there is a
more elegant solution, but this works in all:
On the form that launches the reports, put a hidden textbox. Name it
txtLogoPath. Then in the buttons' click events write:
txtLogoPath.Value = "c:\test\logo1.jpg"
and for button 2:
txtLogoPath.Value = "c:\test\logo2.jpg"
etc.

Then in Report_Open you can refer to that hidden control. Assuming
your form with buttons is called frmPrintReports:
imgLogo.Picture = Forms!frmPrintReports!txtLogoPath.Value

On more recent versions of Access you can use the OpenArgs argument to
DoCmd.OpenReport to send the logo_path to the report.

A more robust implementation of Report_Open would check for the
existence of the image (using the Dir function), and perhaps show a
static 'broken link' image if not found.

-Tom.



Hi,

I have 4 reports created in Ms-access and I will use VB to print those
reports. My problem is I'm not sure if I can control wich report to
print..

Those reports are almost the same, what is different is the logo in the
report header or page header.
Because there are 4 different logo. I want the user to choose in VB
which logo to use and then VB will print the report that the user chose.
Is that possible? I'm new in using reports so any suggestions?
Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***


Nov 13 '05 #2

P: n/a
"Claudia Fong" wrote
I have 4 reports created in Ms-access
and I will use VB to print those
reports.


Do you mean you want to run and print the Access reports from an application
developed using the separate Visual Basic language product, or do you simply
mean Access VBA (Visual Basic for Applications)? Don't worry -- that's not a
chastisement; even Microsoft is not precise in their use of the terms.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.