print report for specific record or for all (1 Viewer)

deekras

Registered User.
Local time
Today, 10:52
Joined
Jun 14, 2000
Messages
169
i have a form to get the account name to print a report for just that account. i want to have the option to print for a specific account or to print for all accounts.

i know it can be done by leaving the combo box empty. i just can't figure out how.

i really would prefer to have ALL as the first field, so that the user sees the word ALL. but if it is too difficult i can do it the other way.
 

BoroLee

Registered User.
Local time
Today, 10:52
Joined
Aug 30, 2000
Messages
90
Have you tried using the *.

If in the query which your report is based on, you use the Like command, the report should print either the selected record, or if * is typed, ALL.

HTH,
Lee.
 

deekras

Registered User.
Local time
Today, 10:52
Joined
Jun 14, 2000
Messages
169
can't connect to that site. any other suggestions?
 

deekras

Registered User.
Local time
Today, 10:52
Joined
Jun 14, 2000
Messages
169
i was able to connect after all. (there is a type in the address you provided in the word microsoft. i typed it myself and connected)however that site does not answer my question.

any other suggestions?
 

deekras

Registered User.
Local time
Today, 10:52
Joined
Jun 14, 2000
Messages
169
i found a good solution (for those who will read this after i am done)

on the on_click of a the preview button of the form where i am to choose the account, i added this code. works great!

Dim stDocName As String
Dim strAccount As String

stDocName = "Transactions"
strAccount = "[Account] = [Forms]![Select Account]![account]"

If IsNull([account]) Then
DoCmd.OpenReport stDocName, acPreview
Else:
DoCmd.OpenReport stDocName, acPreview, , strAccount

End if

notice the 2 commas after the second acPreview (in the else statement)

in the report, make sure that the account criteria is left empty.

works wonderfully.
 

Users who are viewing this thread

Top Bottom