A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Run different reports based on field values?



 
 
Thread Tools Display Modes
  #1  
Old May 25th, 2004, 08:23 PM
Thomas
external usenet poster
 
Posts: n/a
Default Run different reports based on field values?

In Access 2000 I have a database using a form for data
entry. I have it set up so that you can press a command
button to print a letter (Report) for the record that is
currently displayed. However, there are 3 categories of
items that each require a differently formatted letter.
Thus I have 3 reports for each type.

Rather than using 3 separate buttons based on the category
to print the correct report (which would have to be
manually selected), can I set it up so that with one
button it will run the correct report based on the the
value in the category field?

Ie: If Category = Car, then Report 1
If Category = Truck, then Report 2

I am stumped on how to do this.
Thanks!

  #2  
Old May 26th, 2004, 05:25 AM
Marshall Barton
external usenet poster
 
Posts: n/a
Default Run different reports based on field values?

Thomas wrote:

In Access 2000 I have a database using a form for data
entry. I have it set up so that you can press a command
button to print a letter (Report) for the record that is
currently displayed. However, there are 3 categories of
items that each require a differently formatted letter.
Thus I have 3 reports for each type.

Rather than using 3 separate buttons based on the category
to print the correct report (which would have to be
manually selected), can I set it up so that with one
button it will run the correct report based on the the
value in the category field?

Ie: If Category = Car, then Report 1
If Category = Truck, then Report 2


Change the buttons code to include:

If Category = "Car" Then
strDocName = "Report 1"
ElseIf Category = "Truck" Then
strDocName = "Report 2"
Else
strDocName = "Report 3"
End If

DoCmd.OpenReport strDocName, . . .
--
Marsh
MVP [MS Access]
 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.