Text and only text datatype

G

Golfinray

My managers keep putting dates in a text field. Is there any way to use
validation where they can't put dates in a text field or n/a or some other
comment in a date field? I have all the datatypes set but they still manage
to enter stuff in the wrong place on the form and it then ends up in the
table. Thanks so much!!!!
 
J

John W. Vinson

My managers keep putting dates in a text field. Is there any way to use
validation where they can't put dates in a text field or n/a or some other
comment in a date field? I have all the datatypes set but they still manage
to enter stuff in the wrong place on the form and it then ends up in the
table. Thanks so much!!!!

If they are putting something like "This is due on 7/25" into a text field,
then it will be pretty complicated to prevent!

You can use the textbox's BeforeUpdate event on a form to trap cases where
they're putting *just* a date:

Private Sub controlname_BeforeUpdate(Cancel as Integer)
If IsDate(Me!controlname) Then
MsgBox "Please put dates in the date field, not here", vbOKOnly
Cancel = True
<if you want to be nice then>
Me!datefield = Me!controlname ' copy what they entered
Me!controlname.Undo
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top