Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2005, 09:47 AM
ppenn
Guest
 
Posts: n/a
Default Error handling

Hi - I have a form that transfers data from one table to another, one of the fields is used as the primary key, therefore unique. When the form runs the append query I get the following windows error message
Database can't append all the records in te append query -.......
...due to key violations, which is what I need, but the problem is that users click "Yes" instead of "No" that I require to prevent other events from occuring.
Is there a way to disable the windows message and substitute a more meaningful message telling users exactly what is required
Thanks in advance
Peter
 
Old September 1st, 2005, 11:54 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Why do you want to flash an error at your users if you have key violations? Why transfer the data between tables and take the key with you? Why not leave the key in the old table and take the new one the new table is trying to give the record? If you need to refer back to the first table's PK, then keep the PK from the first table as an FK in the new table, so you can refer back to it, and take the new PK in the new table.


mmcdonal
 
Old September 2nd, 2005, 02:07 AM
ppenn
Guest
 
Posts: n/a
Default

Hi - Thank you for your reply - I do appreciate what you say - but the setup I have is - I have two tables with identical data one holds current contracts where the registration number has no duplicates because I do not want two contracts for one vehicle. The other table has contracts that are pending awaiting certain verifications. When all is okay the data is transfered into the main table. The key violations are occuring when a record with a duplicate registration number is attempted to be moved.
What I want is to warn users of this and to prompt them to check the information
I hope that makes some sense
Peter
 
Old September 2nd, 2005, 06:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Why have two tables?

Why not a Yes/No field or, better yet, a date field. The date field would hold the date of verification. If no date, it means it's pending. You'd have one table. You can always query on this date to separate pending from verified.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
error handling Abhinav_jain_mca General .NET 5 December 21st, 2005 01:12 AM
Error Handling twbit BOOK: ASP.NET Website Programming Problem-Design-Solution 1 May 3rd, 2005 09:18 PM
Error handling Hudson40 Access VBA 2 February 11th, 2005 05:32 AM
Error Handling zaeem Classic ASP Basics 2 November 14th, 2003 10:42 AM
Error handling ! ittorget Classic ASP Professional 2 November 14th, 2003 09:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.