Entry Validation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a form which will allow the user to update records in an
underlying table. I want the user to enter a number in the first field of the
form which should be validated against existing numbers in the same field in
the table. If the number is valid the user should be able to proceed. If not,
they should receive an error message. I am not trying to return any
information from the table, just to verify the validity of the entry.
 
Easiest way would be to use the combo box wizard and select "Find a record
on my form based on the value I selected in my combo box"
 
Take a look at the DCount and DLookup functions.

Can you use VBA to any extent?

IF DCount("*","SomeTable","Somefield=" & Me.txtSomeField) = 0 Then
MsgBox "Hey, that's not a valid value"
Else
'Do something else
End If

Of course, you might consider using a combobox with its row source set to the
allowable values. That way you could ensure your users only pick a valid value.
Of course, if you have LOTS of valid values, then this option may not be feasible.
 
Back
Top