Active Form Report

I

Igor G.

I have about 15 forms and one unique raport. All forms have same ID and i
want to report print data from opened form (only one is open, active).
I try with Or function in raport and this work but query ask for other
closed forms.

Example (like my report query):
=[Forms]![Form1]![ID] Or [Forms]![Form2]![ID] Or [Forms]![Form3]![ID]...

How to query recognize active form from many and print ID data and ignore
other?
Thanks.
 
D

Duane Hookom

I would not place a criteria for this in the query. Add code to your
OpenReport like:
Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere

Your report/query is no longe "tied" to any particular form.
 
I

Igor G.

Works fine,
Thanks!

„Duane Hookom“ said:
I would not place a criteria for this in the query. Add code to your
OpenReport like:
Dim strWhere as String
strWhere = "[ID]=" & Me.ID
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere

Your report/query is no longe "tied" to any particular form.

--
Duane Hookom
MS Access MVP

Igor G. said:
I have about 15 forms and one unique raport. All forms have same ID and i
want to report print data from opened form (only one is open, active).
I try with Or function in raport and this work but query ask for other
closed forms.

Example (like my report query):
=[Forms]![Form1]![ID] Or [Forms]![Form2]![ID] Or [Forms]![Form3]![ID]...

How to query recognize active form from many and print ID data and ignore
other?
Thanks.
 
Top