How not to allow duplicate entry in a form field?

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

Guest

I have Form in which i have one field ticket no which is primary key with no
duplicates but i have some other text boxes also. I want if i enter the
ticket no which already exist in the table it should give an error
immediately after pressing tab to go to another field. Not at the end of the
record after entering all other fields.
 
One way of achieving this is to use the DCount function in the Ticket No's
Exit eventHandler to return how many rows already exist in the relevant
table for the ticket no entered. If this result is 1, then you can output a
message box, informing the user that the ticket no already exists and set the
Cancel parameter to True to prevent the user from moving to another control
until the error has been corrected.

Hope This Helps
Gerald Stanley MCSD
 
Back
Top