Talismanic
Registered User.
- Local time
- Today, 20:52
- Joined
- May 25, 2000
- Messages
- 377
I am trying to catch empty fields in my form with this:
Private Sub PayDate_BeforeUpdate(Cancel As Integer)
Dim intQuest As Integer
If IsNull(Me.PayDate) Or Me.PayDate = "" Then
Me.PayDate.BackColor = vbRed
Me.PayDate.ForeColor = vbYellow
intQuest = MsgBox("You must enter a value for this field", _
vbOKOnly, "Entry Error")
Cancel = True
Else
Me.PayDate.BackColor = 65535
Me.PayDate.BackStyle = 0
Me.PayDate.ForeColor = vbBlack
End If
End Sub
However if the user tabs into the field and then out of it without typing anything Access is allowing the entry to continue. What is the problem? Shouldn't it be stopping the action until there is a value in that field.
By the way it does stop action if something it written and then removed, which to me seems like a problem with the Events timing. I would understand it if I was using the After Update but shouldn't the Before Updatate catch it?
Private Sub PayDate_BeforeUpdate(Cancel As Integer)
Dim intQuest As Integer
If IsNull(Me.PayDate) Or Me.PayDate = "" Then
Me.PayDate.BackColor = vbRed
Me.PayDate.ForeColor = vbYellow
intQuest = MsgBox("You must enter a value for this field", _
vbOKOnly, "Entry Error")
Cancel = True
Else
Me.PayDate.BackColor = 65535
Me.PayDate.BackStyle = 0
Me.PayDate.ForeColor = vbBlack
End If
End Sub
However if the user tabs into the field and then out of it without typing anything Access is allowing the entry to continue. What is the problem? Shouldn't it be stopping the action until there is a value in that field.
By the way it does stop action if something it written and then removed, which to me seems like a problem with the Events timing. I would understand it if I was using the After Update but shouldn't the Before Updatate catch it?