deekras
02-28-2001, 08:17 PM
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
03-01-2001, 02:12 AM
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.
Azeem
03-01-2001, 04:09 AM
see microsoft knowledge base article http://support.microosoft.com/support/kb/articles/q98/8/01.asp
or come backt ous in this forum
deekras
03-05-2001, 04:50 PM
can't connect to that site. any other suggestions?
deekras
03-05-2001, 04:56 PM
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?
This article may help Article ID: Q128881
deekras
03-07-2001, 07:39 PM
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.