Pass value of a control to the OnCurrent of a subform

S

Sandra

This is going to sound confusing, and to some,
rediculous, but I need a way to pass the value of an
unbound check box to the OnCurrent Event of a subform on
the next tab of a master form. Due to user errors when
entering data, I have set all my forms to open with
the "Allows" set to No and subforms as Locked. I have an
EDIT button to change all this for editing records. This
works fine for existing records but causes qlitches when
entering new records.

So, I have a NEW button that sets the value of a checkbox
on the main form to True. The OnCurrent event of this
form does the following:

Private Sub Form_Current()
If Me.CheckNew = True Then
Exit Sub
Else
Me.AllowEdits = False
Me.AllowDeletions = False
Me.Detail.BackColor = 12615680
Me.Campaigns.Locked = True
End If
End Sub

I need a way to pass the value of CheckNew to an
OnCurrent Event in another subform. How do I do this?

Thanks,
Sandra
 
D

Dirk Goldgar

Sandra said:
This is going to sound confusing, and to some,
rediculous, but I need a way to pass the value of an
unbound check box to the OnCurrent Event of a subform on
the next tab of a master form. Due to user errors when
entering data, I have set all my forms to open with
the "Allows" set to No and subforms as Locked. I have an
EDIT button to change all this for editing records. This
works fine for existing records but causes qlitches when
entering new records.

So, I have a NEW button that sets the value of a checkbox
on the main form to True. The OnCurrent event of this
form does the following:

Private Sub Form_Current()
If Me.CheckNew = True Then
Exit Sub
Else
Me.AllowEdits = False
Me.AllowDeletions = False
Me.Detail.BackColor = 12615680
Me.Campaigns.Locked = True
End If
End Sub

I need a way to pass the value of CheckNew to an
OnCurrent Event in another subform. How do I do this?

Thanks,
Sandra

If I understand you correctly, the check box "CheckNew" is on the main
form, and you want to test its value in the Current event -- not
"OnCurrent" event, by the way, no matter how many people get this
wrong -- of a subform. That's easy enough:

Private Sub Form_Current() ' the subform's Current event proc

If Me.Parent.CheckNew = True Then
' ... stuff
Else
' ... other stuff
End If

End Sub
 

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