parent form access

  • Thread starter Thread starter bashton
  • Start date Start date
B

bashton

I have three forms which use the same sub form. I have a control on the sub
form which opens a report. The query which generates the report looks to
the subform for information to build the query. I am wondering if there is
a way to change the name of the parent form in the query on the fly. Right
now I am just using FORMS!parentform!subform.FORM!control in the query for
one form. Does anyone have any ideas??

Thanks in advance
 
bashton said:
I have three forms which use the same sub form. I have a control on the sub
form which opens a report. The query which generates the report looks to
the subform for information to build the query. I am wondering if there is
a way to change the name of the parent form in the query on the fly. Right
now I am just using FORMS!parentform!subform.FORM!control in the query for
one form. Does anyone have any ideas??

bashton,

I assume, you're using the control as a WHERE criteria in the query.
Then you could put together and pass the WHERE criteria as an argument
for the OpenReport statement instead of having it in the query:

Dim strWhere

strWhere = "MyCritField =" & Me!control
DoCmd.OpenReport "MyReport", acViewNormal, , strWhere

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
Back
Top