Changing the date

  • Thread starter Thread starter Allie
  • Start date Start date
A

Allie

My main form and sub form (datasheet) are linked by the
date field and another field. If the date is changed on
the main form, I would like the dates on the subform to
change automatically.

I've tried an If statement on the exit event of the date
on the main form with
forms!fSubForm!txtDate = forms!frmMainForm!txtDate

Problem: when the exit event of the main form date runs,
it gives the error message that it cannot find the sub
form.

Any suggestions?
 
Since the control is on the main form, we should be able to use Me for
Forms!frmMainForm to shorten things a little. Next, when a form is opened as
a subform, you can't refer to it directly by its name. You have to refer to
a control on the main form. This control is a container for the subform.

Example:
Me.ctlNameOfSubformControl.Form.txtDate

To get the name of the subform control, open the main form in design mode,
open the Properties sheet, and click on the subform ONE time. The properties
sheet should show the name of the subform control. If you click more than
once, you'll be in the subform and the Properties sheet will show the name
of the subform, not the control holding it.
 
Back
Top