Applying a Query to a Form AND a Report with one click

Jedody69

New member
Local time
Today, 12:13
Joined
Sep 16, 2007
Messages
6
I have a form which, using one of a few buttons, i can apply different queries to the form. Such as "All Transactions", "Reconciled", and "Unreconciled". My problem is that when i select the query on the form, i would also like it to requery the Report that i can generate from the form. So, to apply the same query to the form and the report, and to change when i select a new query.

Thanks for any assistance!
 
Pass SQL to Tag or a custom property

I am assuming that when you say >>> when i select the query on the form <<< that you mean you are passing a new SQL string to the forms record source.

Two ways spring to mind, send the same SQL string to the Tag property of your form, and then in the open event of the report have the following code:
Me.RecordSource = Form_frmYourFormName.Tag

Alternatively create a custom property on your form, and pass the SQL string into the custom property and again at some code to the on open event of your report :

Me.RecordSource = Form_frmYourFormName.prpStrSQL

Where: "prpStrSQL" is the name of your property.
 
Thanks Uncle Gizmo!!! i used the first suggestion with tagging the form and it works PERFECTLY!! Many many thanks.
 
Excellent! You may well wish to consider creating your own custom properties because they work in exactly the same way as the tag property, except you have your own custom property or as many custom properties as you want.

For instance if you wanted to pass a different caption to the report, if you wanted to pass Start date and an end date, things like that then you could pass some in the same way.
 

Users who are viewing this thread

Back
Top Bottom