Duplicate record error message!!

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

Hi,

Question1
I use a form button to append a query record to a table,
but if the record is duplicate with the table record,
a error will show, so I want to know how to set a message box
and cancel this operation.

Question2
When I input a duplicate record in a form index field,
a error message show, I need to input a new value otherwise
I cannot close the form, now I press the ESC key two times
to cancel the action, I want to know how to set code to do this,

Hope someone can help!

Thank!!

Gary
 
Hi Gary,

From your descriptions, I understood that you will meet duplicated record
input and you want to handle the error message. However, I am not sure
about your words "so I want to know how to set a message box and cancel
this operation." Does it mean you want to iliminate the message box?

Based on my knowledge, You could not control message box operations.
However, you'd better make a judgement statement first.

You could make a select statement to see whether there exists a duplicated
record. If it exist, do what you like it to do, if it doesn't exist, then
make an insert.

Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are here to be of assistance!

Sincerely yours,

Michael Cheng
Microsoft Online Support
***********************************************************
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks.
 
Hi Michael,

Sorry for my poor english, actually I want to show a message box and then
cancel the input action,
but I have two case,
1 is cancel the input action in a form primary field
2 is handle the duplicated error message when click on the button to run a
append query.

Thank!!

Gary
 
Hi Gary,

Based on my understandings, I think you could use AfterUpdate property of
each text control (or other input control). In the AfterUpdate functions,
you could check whether it is a duplicated one and whether you need raise a
messagebox to show error message.

You could make AfterUpdate property active following this way
1. In the New Form, add a Text Box
2. Right Click the Text Box, Click Properties (If proerties is selected,
you could ignore this step)
3. In the Properties, select Event tab and click ... on the right side of
After Update
4. Now, you could make your own codes in VBE

Anyway, if above could not resolved your problems, would you please show me
an sample process? In this way, I think, we could get closer to the
resolution. It's also appricated that you could send me your sample mdb
files with detailed descriptions that I could reproduce your issue.

Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are here to be of assistance!

Sincerely yours,

Michael Cheng
Microsoft Online Support
***********************************************************
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks.
 
Back
Top