Control on Field

  • Thread starter Thread starter acss
  • Start date Start date
A

acss

I have a date field on my form that needs to be filled out by the users but
some forget to do this. Is there a way to make this date field blink a color
if the user skips it and goes onto the next field?
 
A really simple way to notify the user if they forgot to fill it out, is:
1. Open your table in design view.
2. Select the date field.
3. In the lower pane of table design, set the field's Required property to
Yes.

If you don't like that, you can use the BeforeUpdate event procedure of the
*form* (not control) to see if the text box IsNull() and cancel the event if
it is.
 
I have a date field on my form that needs to be filled out by the users but
some forget to do this. Is there a way to make this date field blink a color
if the user skips it and goes onto the next field?

Well, forcing the user to enter fields in a particular order sort of goes
against the grain of how Windows apps work. I'd suggest an easier option. Put
code in the Form (not the control's) BeforeUpdate event like:

Private Sub Form_BeforeUpdate(Cancel as Integer)
If IsNull(Me!nameofdatefield) Then
MsgBox "Please fill in the correct date", vbOKOnly
Cancel = True
Me!nameofdatefield.SetFocus
End If
End Sub
 
Back
Top