Print Macro

T13v0hz

Registered User.
Local time
Today, 22:45
Joined
Apr 23, 2004
Messages
11
I need some help with my macro. I currently have 80 seperate jobs which will grow to 450 by the end of May. I have created a macro to select print or print preview of these jobs, but I'm having trouble bringing up only the job selected from a lookup table. It always brings up the first job in the report, (not the job selected), plus all 79 other jobs which makes it harder to find the correct job and print it.
My macro has the code to open the report, the correct views (both print and print preview) and in the Where Condition:

IIf([Forms]![Print Reports Dialogue]![Select Job] Is Null," ","[Job No] = Forms![Print Reports Dialogue!]![Select Job]")

[Select Job] is the lookup table
[Job No] is the key for the lookup table
This code was to make all pages show if none are selected which it does anyway!?!?

I got this code from a book and modified it to suit my forms etc. Do I need to make a specific report (change the query) that can only bring up one page (?) or change the coding above to a working code.
It all worked in the book (apparently) but I can't find a specific reference to their query to check that.

Thanks.
 
Forget about the macro, I used to do it that way also.

Create a "filter by form".

Put the name of your combo into the criteria field (for the related data) of your query as follows:

Like([Forms]![Formname]![ComboName] )

In the property for the combo put:

"*"

to put in all records if none is selected.

This is assuming you have a report bound to a query, when you click a button on your form to open the report, the query will filter based on the combo selection. The asterick in the default value gives all the records if none selected.

I picked this up on this forum but I can't find the post to give him credit. I use it all the time, you can even add multiple criteria options.

Ther may be more efficient ways but it works (as long s I worded it correctly) :p
 

Users who are viewing this thread

Back
Top Bottom