PC Review


Reply
Thread Tools Rate Thread

append query error

 
 
MES via AccessMonster.com
Guest
Posts: n/a
 
      31st Oct 2006
I have an append query that I run from a form. Employee information
(including badge #, last name, first name, etc.) is included in the form for
appending to the table. The primary key of the table is badge #, so if
someone were to put in a duplicate badge #, they get the 'file can't append
all records in the append query' message. I then get the VB run-time error
3059.

I would like to avoid this, and instead of the error messages have a message
box come up and tell the user that the badge # they input is a duplicate and
they must redo and/or choose another number. So it would be putting the
focus back on the data entry form and clearing the duplicate badge # field.

How can this be done?

Any help would be greatly appreciated. Thanks in advance.

--
Message posted via http://www.accessmonster.com

 
Reply With Quote
 
 
 
 
Steve Schapel
Guest
Posts: n/a
 
      31st Oct 2006
MES,

If DCount("*","YourTable","[Badge #]=" & Me.Badge) > 0 Then
MsgBox "Badge # already exists in the table"
Else
< your append code >
End if

By the way, as an aside, it is not a good idea to use a # as part of the
name of a field.

--
Steve Schapel, Microsoft Access MVP

MES via AccessMonster.com wrote:
> I have an append query that I run from a form. Employee information
> (including badge #, last name, first name, etc.) is included in the form for
> appending to the table. The primary key of the table is badge #, so if
> someone were to put in a duplicate badge #, they get the 'file can't append
> all records in the append query' message. I then get the VB run-time error
> 3059.
>
> I would like to avoid this, and instead of the error messages have a message
> box come up and tell the user that the badge # they input is a duplicate and
> they must redo and/or choose another number. So it would be putting the
> focus back on the data entry form and clearing the duplicate badge # field.
>
> How can this be done?
>
> Any help would be greatly appreciated. Thanks in advance.
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Append query error =?Utf-8?B?U01CUg==?= Microsoft Access Queries 3 15th Jun 2006 04:20 PM
Append Query Error =?Utf-8?B?QWlyZ2FzUm9i?= Microsoft Access Queries 8 24th Feb 2006 01:36 PM
Link CSV file created query append query to append data =?Utf-8?B?ZXNwYXJ6YW9uZQ==?= Microsoft Access Queries 2 5th Jul 2005 04:49 PM
Error from Append Query =?Utf-8?B?Q3JhaWcgWi4=?= Microsoft Access Queries 3 1st Apr 2005 08:49 PM
Error trapping for "MS Access can't append all the records in the append query" Dale Microsoft Access VBA Modules 6 29th Dec 2004 02:27 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:55 PM.