Form Field - No Duplicate


J

John Torres

Is there any way that a field in access form tells you immediately once a
record is duplicated? I went to Table and indexed it to "No Duplicates" but
it appears that a dialogue box appears after the whole entry form is filled
and then the warning sign.
Thanks,
John
 
Ad

Advertisements

J

John Torres

Hi Al,
How do i do that? Is that a code that needs to be written? I tried typing
refresh and it was looking for macros.
Thanks again.
John
 
Ad

Advertisements

A

Al Campagna

John,
In Form Design mode, select the field you want to monitor for dupes (ex.
MyField).
In the properties box for that field, find the AfterUpdate event.
Enter "Event Procedure" in the AfterUpdate text field. (no quotes)
(OR... Using the down arrow to the right of the textbox, select
[EventProcedure])
Click the little three dot button that appears on the right of the
AfterUpdate text box. (...)
You are now in the form's module, and you should see...

Private Sub MyField_AfterUpdate()

End Sub

Add your Refresh...

Private Sub MyField_AfterUpdate()
Refresh
End Sub

Now, each time MyField's value changes, if it violates the NoDuplicates
rule, it should bark that right away.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

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