Paremeter form

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

Guest

Hello,
I have a form to enter follow up information, when the user enter the ID#,
it look up the old information, and also have fields enter new information.
The ID# is unique, no duplicate. The information enter into this form is save
in the a table, and the other information is in another table.

But here is my problem:
When the user already enter the ID# and the follow up information. The next
time they open the form, but they forgot they already entered and try to
enter it again,
when they enter the ID#, the information they entered before won't show up.

What should I do to let the user knows this ID# has been entered?

Thanks
 
Use the BeforeUpdate event of the control to block the user from entering a
duplicate (or use its AfterUpdate if you just want to warn them.)

In this event, DLookup() the table to see if the value already exists. For
help on this, see:
Getting a value from a table: DLookup()
at:
http://allenbrowne.com/casu-07.html

You will want to do this only if the Value of the control is not the same as
its OldValue (i.e. an existing record is not a duplicate of itself.)
 
Thank you for response.
I learn a lot from your website.

But I have no idea for how to write a code.
Do you have any information on your website?
 
How to write VBA code? Now that's a big question. :-)

Use If ... Then.
Help with DLookup() as indicated.
If the value exists, use:
Cancel = True
 
Back
Top