What Event is being triggered?

krazykaigh

Registered User.
Local time
Today, 13:42
Joined
Apr 10, 2012
Messages
11
Hi all,

I am attaching a .jpeg of some Form - Subforms I am using. In the subform marked Specific Inheritances, there is a sub-subform called Prime Beneficiaries. In Prime Beneficiaries subform, there is a check box with the label "Alt".

What I am trying to do is make sure if Alt is checked and user does not complete ANY of the Alternate_Bene information that it will catch this and so something.

I have tried the Alt_Bene checkboxes lostfocus event. But if I check the box and then go outside the Specific Inheritances form, nothing is triggered. Next I tried the subform controls Exit event, but that doesn't trigger either. I have even tried the Prime Beneficiaries subform's lostfocus event, and still nothing.

HOWEVER, if I only move inside the Specific Inheritances form like to the Item text box, the sbfrm_EXIT events get triggered.

Any suggestions?

What is supposed to happen is the Alternate Beneficiaries subform should be made not visible and the checkbox should be unchecked.

So, I cannot figure out which event will catch leaving the checkbox checked and Alternate Bene's with no related records.

Thanks.
 

Attachments

  • Forms - PrimeBene and AltBene Subform.jpg
    Forms - PrimeBene and AltBene Subform.jpg
    82.5 KB · Views: 156
Last edited:
You would use the subform's BEFORE UPDATE to check. And then issue a

Cancel = True

if it doesn't meet the requirements.


So something like this (this is just a simple example):

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
   If Me.CheckboxNameHere And Len(Me.TextBox1 & vbNullString) = 0 And Len(Me.TextBox2 & vbNullString) = 0 Then
      Cancel = True
      Msgbox "You need to fill in xxxxx if you check the box", vbExclamation, "Data Entry Error
  End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom