User Input Validation

P

PosseJohn

I have a form that allows editing, single form view.

I want to validate each field for valid entries:
Using IsNumeric etc.
Is within a certain range.

When I perform this validation using Before_Update, I am receiving the
following error..."You must save the field before you execute the GoToControl
action, the GoToControl method, or the SetFocus method."

Here is my code:
Private Sub datReminderInterval_BeforeUpdate(Cancel As Integer)
If Me.datReminderInterval.Value < 1 Or _
Me.datReminderInterval.Value > 60 Or _
IsNull(Me.datReminderInterval) Or _
Not IsNumeric(Me.datReminderInterval) Then
DoCmd.SetWarnings False
MsgBox "Value must be 1 - 60", vbCritical + vbApplicationModal +
vbOKOnly, "Invalid data entry"
Cancel = True
Me.datReminderInterval.SetFocus
DoCmd.SetWarnings True
Exit Sub
End If
End Sub


Hellllllllp.....Thank you.
 

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