Solved

Duplicate Form Record

Posted on 2011-03-11
5
252 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Stellar!!!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now