Error number

1jet

Registered User.
Local time
Tomorrow, 02:01
Joined
Sep 15, 2008
Messages
117
Hi all,
My table, tblBusiness has two fields. [ABN] and [Business Name].
ABN is the primary key.

I've currently got a form to add data to this table, and looking to create my own error message when the user tries to use an existing ABN.

I have two choices.
1. The long way. See if the form's ABN exists in a tblBusiness query recordset
2. The easier way below...

When I attempt to use an existing ABN, the standard "changes not successful because they would create duplicate values in the index" message appears.

I've seen in other languages where error messages have their own number. How do I find the error number of this particular one and use in an IF statement?

i.e.

if error_number = xxx
. msgbox "ABN already exists"
. goto function_end
end if

...continue code...
 
It is error 3022.

cheers
so how did u find this error number?
i only ask because if i try duplicate keys manually via table or via form and insert query, the errors look as if they may have different numbers
 
Have your error handler print out both the Error Number and the Description.
 

Users who are viewing this thread

Back
Top Bottom