OpenReport Action and Subforms (1 Viewer)

Jon.N

Registered User.
Local time
Today, 06:59
Joined
Nov 24, 2000
Messages
43
Please help! I am trying to run an OpenReport action in a macro based on a control that is in a subform. Normally, if the control was in a form I would use I would use [controlName]=[Forms]![FormName]![ControlName] as the where condation. I cannot work out how to point the where condition to the control in the subform.
 
R

Richie

Guest
=Forms![YourMainFrmName]![SubformName subform].Form![FieldName]
 

Jon.N

Registered User.
Local time
Today, 06:59
Joined
Nov 24, 2000
Messages
43
Many thanks for this reply. Unfortunately it prints all records and not just the one record where the focus is. However I'm sure this will come in useful at another stage in development.

I managed to get it to print out just one record by,
- Making the query that opens the main form and finds the record also open the forms from where the subforms are derrived.
- They opened as icons behind the main form.
- I set the Where Condition in the macro to [MainTable]=[Forms]![FormName]![FieldName].
- I also set the On Lost Focus property of the Command Button that starts the process to =[FieldName].
- This transfers the button's focus to the correct form behind the subform.
- I make sure the user only ever sees the main form.

I hope this explanation is useful to someone. or if someone knows a better way please comment.
 

Users who are viewing this thread

Top Bottom