Using ADODB, how do I create a msgbox when duplicate data is enter

G

Guest

Hello,

I am having a problem creating a msgbox, when data entered through a form
into a table is duplicated. I would like for a msgbox to popup, and warn the
user for dupliucate data, before the actual data is entered into the table.
I have an index for no duplicate set on a field in a table. How would I go
about this? I have seen code for Jet, and have tried to translate it over to
ADODB, but with many problems. Any help with this will be greatly
appreciated.

Thanks
 
G

Guest

I don't know the code which is causing the problems with Jet but have you
tried working with the 'match' something like:

before_update from the form

open the recordset and look for a match if there is a match raise the
messagebox and exit the sub so the user can make the changes and otherwise
resume with the record append to the table.
 
G

Guest

How would I go about doing this? I try to "match" what is already in the
recordset, and I get Runtime Errors with Access. I just need to match 1 set
of data, out of 6 that is getting entered.
 
G

Guest

here is advice from Steve Schapel that helped on a similar requirement:
------------------------------------------------------------------------------------------
Make a macro with the MsgBox action, and enter an appropriate message to
display. In the Condition (if you can't see a Condition column in the macro
design window, select it from the View menu), put the equivalent of this...
DCount("*","YourTable","[FieldName]='" & [TextBoxName] & "'")>0

Assign this macro on the Before Update event of your form, .
 

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