Changing the 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?
 
W

Wayne Morgan

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top