Need to check duplicate of a field in an access form

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

Guest

Hi,
I am adding a record in a table from a form. The field is called LineItemID
while the form field is called LineNumber. I need to prevent duplicate from
going in the field. I am trying to calculate the record number corresponding
to the new input. If it is > 1 then it should prevent entry by giving an
error message.

However, in the code, when I am writing the following, I am getting an error
message. I would appreciate any help. Thanks

CODE:
select LineItemId from tblLineItems where LineItemID =
Forms!frmEditLineItems!LineNumber
 
You can do that in your table by creating a unique index on that field or
combination of fields.

Steve
 

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