View Single Post
Old 03-05-2004, 08:29 AM   #2
Mile-O
Back once again...
 
Mile-O's Avatar
 
Join Date: Dec 2002
Location: Glasgow, UK
Posts: 11,312
Thanks: 4
Thanked 118 Times in 108 Posts
Mile-O will become famous soon enough
Arrow

First of all you don't have "two primary keys" in one table - you have a composite key - a primary key comprising two or more fields.

To make your own message you have to trap the Form's Error.

I don't know the number of this data error offhand but you can get it by putting the following line into the Code Builder's module of the Form's OnError event.

Code:
MsgBox DataErr
Run the code and cause the error. You'll get a message box displaying the number.

Now, replace the code with:

Code:
If DataErr = **** Then
    MsgBox "You already have this combination in the table.", vbInformation
    Response = acDataErrContinue
End If
Replace **** with the error number...
Mile-O is offline   Reply With Quote