Rickz
12-07-2017, 02:23 PM
hi i have stuck in the forms update event where the event is not firing up.
i have to check or validate certain feilds and have to make sure they are not empty in the fields. example i have 8 fields.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Form_Master.Primary_Key) = True Then
Me!Primary_Key.SetFocus
Msg = "Please enter Primary key"
Style = vbCritical
Title = "Data Record Entry"
Response = MsgBox(Msg, Style, Title)
If Response = vbOKOnly Then ' User choose Yes.
MyString = "Yes" ' Perform some action.
End If
Cancel = True
Exit Sub
ElseIf IsNull(Form_Master.AddSuffix) = True Then
Me!AddSuffix.SetFocus
Msg = "Please enter AddSuffix"
Style = vbInformation
Title = "Data Record Entry"
Response = MsgBox(Msg, Style, Title)
If Response = vbOKOnly Then ' User choose Yes.
MyString = "Yes" ' Perform some action.
End If
Cancel = True
Exit Sub
ElseIf CppValue.ListIndex = -1 Then
Me!CppValue.SetFocus
Msg = "Please enter Grouping information"
Style = vbInformation
Title = "Data Record Entry"
Response = MsgBox(Msg, Style, Title)
If Response = vbOKOnly Then ' User choose Yes.
MyString = "Yes" ' Perform some action.
End If
Cancel = True
Exit Sub
i have to check or validate certain feilds and have to make sure they are not empty in the fields. example i have 8 fields.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Form_Master.Primary_Key) = True Then
Me!Primary_Key.SetFocus
Msg = "Please enter Primary key"
Style = vbCritical
Title = "Data Record Entry"
Response = MsgBox(Msg, Style, Title)
If Response = vbOKOnly Then ' User choose Yes.
MyString = "Yes" ' Perform some action.
End If
Cancel = True
Exit Sub
ElseIf IsNull(Form_Master.AddSuffix) = True Then
Me!AddSuffix.SetFocus
Msg = "Please enter AddSuffix"
Style = vbInformation
Title = "Data Record Entry"
Response = MsgBox(Msg, Style, Title)
If Response = vbOKOnly Then ' User choose Yes.
MyString = "Yes" ' Perform some action.
End If
Cancel = True
Exit Sub
ElseIf CppValue.ListIndex = -1 Then
Me!CppValue.SetFocus
Msg = "Please enter Grouping information"
Style = vbInformation
Title = "Data Record Entry"
Response = MsgBox(Msg, Style, Title)
If Response = vbOKOnly Then ' User choose Yes.
MyString = "Yes" ' Perform some action.
End If
Cancel = True
Exit Sub