Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing Error msg's with Custom messages 1

Status
Not open for further replies.

njitter

Technical User
Sep 4, 2001
122
0
0
US
Hi,

i've got a table with the following structure

Boxes
box_id Autonumber Primary Key
box_nr Text(10) Indexed (no duplicates)

each box can contain a number of documents.

I've created a form with box_nr and a subform to put the documents in.

When i create a duplicate number Access correctly complaints about it. But the message Access displays is rather cryptic (The changes you requested were not successfull because they would create duplicate values in the primary key, index or relationship. Change the data in the field blah blah).

I would rather just display a simple message like 'Box number already in use'.

I've tried to build an After_Update Event with an OnError routine but it would not trap this message.

How do i get my simplified message??

Thank you for your help,

Martijn

---
There are no stupid Questions -- just stupid People
 
Try moving the On_Error routine to the Before Update event. I believe after update is too late. Maq B-)
<insert witty signature here>
 
Maquis,

i already tried that one. Also tried OnChange

But thanks for the suggestion.

Martijn
---
There are no stupid Questions -- just stupid People
 
The best way around this is to not link the form directly to your table or query.
change the form so that when your are done with entering the infromation it runs a series of checks on the data.
Then enters that data into the table.




 
Thank you all for your help. I found the solution to this problem in some old thread on this Forum.

Take a look at thread181-34420 yourself

Solved all my troubles..

Njit
---
There are no stupid Questions -- just stupid People
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top