Changing DataEntry property of subform (1 Viewer)

projecttoday

Registered User.
Local time
Today, 17:32
Joined
Jan 5, 2011
Messages
51
Is there any way to change the dataentry property of a subform outside the subform? The user wants a main form with a tab contol on it. On the first page there is a form, actually a subform of the main form. The main form is unbound. Click on the second tab and you see the same form open for new entry. The following code in the main form cause an object or data member not found error on Me.Campaign.DataEntry.

Code:
Private Sub TabCtl0_Change()
If Me.TabCtl0.Value = 0 Then
    Me.Campaign.DataEntry = True
ElseIf Me.TabCtl0.Value = 1 Then
    Me.Campaign.DataEntry = True
End If
End Sub

When you click on a tab the subform is not loaded, it's not opened, and it's not activated. Does anybody know of a way to get that property set? Currently I have 2 copies of the same form (with DataEntry = yes and no) and I like to have just one copy of the form.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 07:32
Joined
Jan 20, 2009
Messages
12,852
Properties of a subform object are referred to from the main form via the Form property of the subformcontrol. For example:

Me.subformcontrolname.Form.DataEntry
 

Thales750

Formerly Jsanders
Local time
Today, 17:32
Joined
Dec 20, 2007
Messages
2,098
Properties of a subform object are referred to from the main form via the Form property of the subformcontrol. For example:

Me.subformcontrolname.Form.DataEntry

You'll need to add "= True" or "= False" as the case may be.
 

Users who are viewing this thread

Top Bottom