Solved

Duplicate Form Record

Posted on 2011-03-11
5
255 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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.

749 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