Can't Find form

  • Thread starter Thread starter jonathan
  • Start date Start date
J

jonathan

Hi, running this code on the click event of a tick box
Basically i want to expand a datasheet inside a subform of the main form.

If me.expandsubform = True Then
Forms!tasks.SubdatasheetExpanded = True
Else
Forms!tasks.SubdatasheetExpanded = False
End If

thx
jonathan
 
I haven't tried this to see if it will work for expanding the subdatasheet, but the
current syntax is incorrect for referring to a subform. Hopefully, correcting that will
allow the rest to work.

To refer to a subform, you need to refer to the control on the main form that holds the
subform, then to the form. The subform isn't "open" in it own right, so referring to it by
name doesn't work. To get the name of the subform control you need to open the main form
in design mode, open the Properties sheet, then click on the subform ONE time. The
properties sheet will then show the name of the subform control. If you click twice, you
will be in the control and the Properties sheet will show the name of the form, not the
control holding it.

Example:
Forms!MainForm!SubformControl.Form.SubdatasheetExpanded = True
 
Back
Top