Checking is entry exists

P

Paul B.

I have a text box which is formatted for 8 characters that is used to record
the 'Epistry' number which is xxxxxx-x.

I need to search the existing entries to make sure the number that is being
entered is unique before the user continues with the data entry. I have the
following:

If Not IsNull(DLookup("EpistryNumber", "tblEpistry", "EpistryNumber =" &
[EpistryNumber])) Then

Which does not work. I am not sure if the reason is the dash in the number,
or the fact that the number is in a text box.

Thanks in advance.
 
M

Marshall Barton

Paul said:
I have a text box which is formatted for 8 characters that is used to record
the 'Epistry' number which is xxxxxx-x.

I need to search the existing entries to make sure the number that is being
entered is unique before the user continues with the data entry. I have the
following:

If Not IsNull(DLookup("EpistryNumber", "tblEpistry", "EpistryNumber =" &
[EpistryNumber])) Then

Which does not work. I am not sure if the reason is the dash in the number,
or the fact that the number is in a text box.


Yes, the dash has everything to do with it, in the sense
that it implies that the EpistryNumber is a Text type field
in the table. In that case, it should be written:

. . . , "EpistryNumber ='" & EpistryNumber & "' ")) Then
 

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