Help with Duplication please

de049

Registered User.
Local time
Today, 08:51
Joined
Sep 24, 2001
Messages
18
Hi all,

I need to sort out the following:

Whenever the user tries to enter a value that already matches an existing value (duplication) they get the standard MS Access message box telling them so. How can I:

1.Set my own msgbox to appear whenever they enter a duplicate value. They message they get now appears after an on_click event. They press the "Save Record" button and they get it. I would like to keep it this way.

2.Only certain fields will have "no duplication" set. So how can I have the name of the field(s) in question appear on the message box itself so as to alert the user of where they have entered the duplicate value. So for example, if the duplicate value if entered in field "Name", then the field NAME would appear on the msgbox.

Thanks for any help!
 
Last edited:
Hopefully you are aware of error handling. Its here that you can replace the custom message with one of your own.

Within the on Error event of your form try the following:

On Error Resume Next
MsgBox err.Number & " - " & err.Description


Now when an error is triggered on your form a message is displayed showing the number and description of the error generated.

From there you can construct some arguments

If err.Number = 1234 Then
On Error Resume Next
MsgBox "This is my custom message for " & err.Number
End If

Basically you need to get hold of the appropriate error number so you can catch it if it is triggered.
 
de049 said:
2.Only certain fields will have "no duplication" set. So how can I have the name of the field(s) in question appear on the message box itself so as to alert the user of where they have entered the duplicate value. So for example, if the duplicate value if entered in field "Name", then the field NAME would appear on the msgbox.

Thanks for any help!

Forget to anser this one - search within MS Access help for ActiveControl
 

Users who are viewing this thread

Back
Top Bottom