checking for duplicates

S

sarahphonics

I know there is many questions on this but I cannot seem to get the code to
work for my database.

Basically I have a form called try2. It has two textboxes 'qtr' which
expects a date to be entered and 'hosp' which is for text. When these two
textboxes are completed the user clicks a button which then opens a form to
input data copying across the values of these textboxes to another two
textboxes 'Quarter' and 'Hospital'.

What I want to do is, once the 'qtr' and 'hosp' text boxes are complete,
when the user clicks on the button to open the form for adding data, I first
want it to check if there is a record already entered in the table 'MAIN'
with the same values in the variables 'Quarter' referring to 'qtr' and
'Hospital' referring to 'hosp'. I know that you use Dlookup but it is the
quotation marks which confuse me. If there is already a record with the same
quarter and hospital, a pop up box tells the user it is already entered.

any help is appreciated

thanks
Sarah
 

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