Filter By Selection/Form - then report selected only

vangogh228

Registered User.
Local time
Today, 06:52
Joined
Apr 19, 2002
Messages
302
Hello all.

I would like to place a "Print Report" button on my primary form that allows a Filter By Selection (OR Filter By Form) first, then when selecting the button will view or print my already-created primary report but only for the records that were selected by the filter.

I looked and looked, but am not sure even what to search for in the forum. I know this has to be simple.

Form is called PrimaryForm.
Report is called PrimaryReport.

Thank you.

Tom
 
I'm not sure if this is the answer you're looking for, but take a look at the attachment file.

hth,
Michael
 

Attachments

Michael:

Thanks, but not exactly what I'm looking for. That example has prebuilt queries that the report then is based on. I want to be able to use the filtering tools and then select the report button, which would run the report based on the current filter.

Thanks for the reply!

Tom
 
Aaaaaarrrrrrrrrrrggggggggghhhhhhhhh!!!!!!!!

I found information at

http://support.microsoft.com/kb/q208548/

But am having trouble with the syntax of the following:

Private Sub Command96_Click()
If Me.Filter = "" Then
MsgBox "Apply a filter to the form first."
Else
DoCmd.OpenReport "RelationshipsbyPrimary", acViewPreview, , Me.Filter
End If
End Sub

The MsgBox line works fine, but the DoCmd line will not work... I am using A2K3, does that matter?? I know so little VBA, and this has become a point of great frustration. Any help is GREATLY APPRECIATED!!!!

Instead of opening the report, it gives me a window as if I were entering a parameter for the filter, then it opens the report and gives me all the records instead of the filtered ones from the "Filter by Form" function.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom