dbTalk Databases Forums  

Passing a Header to a Report !

comp.databases.ms-access comp.databases.ms-access


Discuss Passing a Header to a Report ! in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Prakash
 
Posts: n/a

Default Passing a Header to a Report ! - 12-23-2009 , 01:09 AM






I have 2 buttons on a form. Both buttons invoke the same report named
"BS".

In my report header I have a label depicting the report header. If I
click button 1, I'd like this report header to display "Profit & Loss
Statement" and if I click button 2, I'd like this report header to
display "Balance Sheet".

Here's my code on one of the buttons to invoke the report:

stDocName = "BS"
where_condition = "[category]= 'Income' or [category]= 'EXPENSE'"

DoCmd.OpenReport stDocName, acPreview, , where_condition


I'd appreciate any help.

Regards,
Prakash.

Reply With Quote
  #2  
Old   
Allen Browne
 
Posts: n/a

Default Re: Passing a Header to a Report ! - 12-23-2009 , 03:18 AM






If this is Access 2002 or later, pass the desired title in the OpenArgs of
OpenReport.

You can then use this in the Control Source of a text box on the report:
=[Report].[OpenArgs]

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Prakash" <prakashwadhwani (AT) gmail (DOT) com> wrote

Quote:
I have 2 buttons on a form. Both buttons invoke the same report named
"BS".

In my report header I have a label depicting the report header. If I
click button 1, I'd like this report header to display "Profit & Loss
Statement" and if I click button 2, I'd like this report header to
display "Balance Sheet".

Here's my code on one of the buttons to invoke the report:

stDocName = "BS"
where_condition = "[category]= 'Income' or [category]= 'EXPENSE'"

DoCmd.OpenReport stDocName, acPreview, , where_condition


I'd appreciate any help.

Regards,
Prakash.

Reply With Quote
  #3  
Old   
Prakash
 
Posts: n/a

Default Re: Passing a Header to a Report ! - 12-23-2009 , 03:40 AM



On Dec 23, 12:18*pm, "Allen Browne" <AllenBro... (AT) SeeSig (DOT) invalid>
wrote:
Quote:
If this is Access 2002 or later, pass the desired title in the OpenArgs of
OpenReport.

You can then use this in the Control Source of a text box on the report:
* * * * =[Report].[OpenArgs]

--
Allen Browne - Microsoft MVP. *Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Prakash" <prakashwadhw... (AT) gmail (DOT) com> wrote in message

news:fda1d36d-6275-4845-9381-2c3fd99705f3 (AT) b2g2000yqi (DOT) googlegroups.com...

I have 2 buttons on a form. Both buttons invoke the same report named
"BS".

In my report header I have a label depicting the report header. If I
click button 1, I'd like this report header to display "Profit & Loss
Statement" and if I click button 2, I'd like this report header to
display "Balance Sheet".

Here's my code on one of the buttons to invoke the report:

* *stDocName = "BS"
* *where_condition = "[category]= 'Income' or [category]= 'EXPENSE'"

* *DoCmd.OpenReport stDocName, acPreview, , where_condition

I'd appreciate any help.

Regards,
Prakash.
Thank you Allen !! Worked like a dream ... except I had to change the
label to a text box.

Muchos Gracias.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.