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
 

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

Back
Top