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 January 17th, 2006, 02:40 PM
Authorized User
 
Join Date: Apr 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lizhaskin
Default Duplicate problems

Hi Guys, please can you help. I have a form based on the “BookingTbl”. To save the user time, I have put a CommandButton which will duplicate the details of a specific booking. The code I used for this was generated by the wizard and is:

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70

Ie: Select Record ; Copy Record ; Paste Append

The problem I am experiencing is that Access is not recognizing the BookingID of the records appended to the BookingTbl this way. (BookingID is an AutoNumber field) So now when I try and add a new record to the BookingTbl, it will use the same BookingID as one of the duplicated record and then tells me that I can’t save the record because it would create a duplicate value in an index. Why does it do this?

Any ideas would help
Thanks
Liz



 
Old January 17th, 2006, 03:51 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is copying the auto-number field, and since paste does not invoke the create record routine it is never overwritten. I'd recommend doing a SQL append operation, drawing the values from the form and the auto-number should take care of itself then.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate Attribute Name Mitali XSLT 4 July 25th, 2008 01:26 AM
duplicate records vanitha Reporting Services 2 May 31st, 2007 01:54 AM
Supressing duplicate p_gauri7 Crystal Reports 2 December 16th, 2004 04:55 PM
duplicate rows msrnivas Classic ASP Components 1 August 26th, 2004 02:07 AM
Duplicate E-Mails SerranoG Forum and Wrox.com Feedback 3 March 30th, 2004 03:12 PM





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