G
Guest
I need to set up some VB code to alert the inputter that they need to
complete a couple of required fields depending on the value of a third field.
At present I have some code (below) attached to the BeforeUpdate event of the
form that checks for one of the fields but I need to extend it to the 2nd
field and I don't know how to.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.[NYSPA Received] And IsNull(Me.Date_NYSPA_Received) And
Me.New_Cease = "New" Then
MsgBox "Date NYSPA Received is required" & vbCrLf & "Record will not be
saved"
Cancel = True
End If
End Sub
The 2nd field is called Service Level and it also becomes mandatory if
New/Cease = "New". I will need to change the message that displays to reflect
both fields unless there is a way of individually identifying which field is
not completed.
I'm fairly new to VB so please be gentle with me!
complete a couple of required fields depending on the value of a third field.
At present I have some code (below) attached to the BeforeUpdate event of the
form that checks for one of the fields but I need to extend it to the 2nd
field and I don't know how to.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.[NYSPA Received] And IsNull(Me.Date_NYSPA_Received) And
Me.New_Cease = "New" Then
MsgBox "Date NYSPA Received is required" & vbCrLf & "Record will not be
saved"
Cancel = True
End If
End Sub
The 2nd field is called Service Level and it also becomes mandatory if
New/Cease = "New". I will need to change the message that displays to reflect
both fields unless there is a way of individually identifying which field is
not completed.
I'm fairly new to VB so please be gentle with me!