Solved

Duplicate Form Record

Posted on 2011-03-11
5
253 Views
Last Modified: 2012-06-22
Good afternoon,


I am almost done with a product of mine and the end user has suggested a fix for a potential long term problem. I have a command located on my form that "duplicates the records". When duplicating, this helps the user quickly add a new record that is similar to some one of the old records.

What I would like to see happen, is clear some of the data fields after the duplication automatically. For instance, on ever record, I need to change the PO#. I would like the form to duplicate and then delete the PO Number that is also duplicated. Is this possible? I have many items I would like to clear not just the PO#.

Any suggestions on how to get this done?

Any help would be much appreciated!

Thanks!
0
Comment
Question by:hcp27
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:RemRemRem
ID: 35113904
The button that does the copying can have code added after the creation of a new record:

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
    Me.<fieldname> = ""
    Me.<otherfieldfieldname> = ""

Note - if the <fieldname> field is a required field, you'll need to put something in it - if numeric, that might be just a "0" value, for example
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 35114468
hcp27,

I may suggest to post the code you use on how your records are duplicated. We would be able to do a tweak of the code to resolve your issue.

Sincerely,
Ed
0
 

Author Comment

by:hcp27
ID: 35128900
Mind Superb,

I simply used the duplicate record on the button wizard. Nothing fancy.

Rem Rem,


if i used the mentioned wizard above can i still use that code?
0
 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 500 total points
ID: 35129101
Put this code on the click event of the button:

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
Me.PO#=""


Sincerely,
Ed
0
 

Author Closing Comment

by:hcp27
ID: 35129174
Stellar!!!!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question