G
Guest
Can someone please help.
I am creating a database and am having some difficulty with one aspect of
it. Below you will find the code that I am using to ensure that a user
inputs the correct data into the "Staging" field and the RNCNumber field.
The contingency is that if the "Staging" field contains "Production" then the
user is required to enter data in the RNCNumber field.T What am I doing
wrong? If I try
to go to another record or a new record and the conditions are not met,
shouldn't the Msgbox data pop up. It doesn't. And the area around the
message box is red which means that I have an error somewhere. I have tried
everything, and I am sure it is something minor that I am missing. Please
Help!!!!! .
Private Sub Form_BeforeUpdate(Cancel As Integer)
If (Me.[Staging] = "Production" And IsNull(Me.[RFCNumber])) Then
MsgBox("'RFC #' Cannot Be Blank if Targeted Environment = Production",
[vbCritical] [vbOKOnly], ["Data Missing"]
Cancel = True
Me.[RFCNumber].SetFocus
End If
End Sub
I am creating a database and am having some difficulty with one aspect of
it. Below you will find the code that I am using to ensure that a user
inputs the correct data into the "Staging" field and the RNCNumber field.
The contingency is that if the "Staging" field contains "Production" then the
user is required to enter data in the RNCNumber field.T What am I doing
wrong? If I try
to go to another record or a new record and the conditions are not met,
shouldn't the Msgbox data pop up. It doesn't. And the area around the
message box is red which means that I have an error somewhere. I have tried
everything, and I am sure it is something minor that I am missing. Please
Help!!!!! .
Private Sub Form_BeforeUpdate(Cancel As Integer)
If (Me.[Staging] = "Production" And IsNull(Me.[RFCNumber])) Then
MsgBox("'RFC #' Cannot Be Blank if Targeted Environment = Production",
[vbCritical] [vbOKOnly], ["Data Missing"]
Cancel = True
Me.[RFCNumber].SetFocus
End If
End Sub