Validation Rule

trythis

Registered User.
Local time
Yesterday, 21:46
Joined
Jul 27, 2009
Messages
67
I have a form that you enter start date and time and end date and time

I have an input mask that uses this format 11/13/2009 7:00

I want to use a validation rule or code that will not let them save the record if this format is not perfect. No Nulls allowed.

People are deleting the date and time and leaving it blank. I tried requiring it on the table but it still lets them save the record.

What can I do here?

Thanks,
Tina
 
You could put some code in Form's Before Update event;
Code:
If IsNull(Me.FieldName) Then
     MsgBox ("Please enter a Date and Time Value"
     Me.FieldName.Setfocus
End If
 
You could put some code in Form's Before Update event;
Code:
If IsNull(Me.FieldName) Then
     MsgBox ("Please enter a Date and Time Value"
     Me.FieldName.Setfocus
End If

You would need to add the part in red ...


Code:
If IsNull(Me.FieldName) Then
     [COLOR="Red"]Cancel = True[/COLOR]
     MsgBox ("Please enter a Date and Time Value"
     Me.FieldName.Setfocus
End If
 
Ah yes, my bad. You wont want the orphaned left parenthesis, in the MsgBox statement, either :o
 
That did the trick.

You guys and gals rock.

Thanks,
Tina
 

Users who are viewing this thread

Back
Top Bottom