Duplicate form record into another form record

hbah923

New member
Local time
Today, 17:06
Joined
Apr 5, 2011
Messages
7
I have one database called "Special Services Iron Database". On this database there are three forms. One is called "Special Services Iron Database", "PAST Iron Database" and "BLANK IRON SHEETS". I need to add a control button that when clicked on the "BLANK IRON SHEETS" form will copy the record form being viewed, automaticaly open the "Special Services Iron Database" and past into a new record. On the "Special Services Iron Database" form I need a control button that when clicked will copy the record form being viewed into a new record in "PAST Iron Database" (doesnt need to open the "PAST Iron Database"). All forms are the same so I can have both buttons on all the forms and just name them something like "Copy to PAST" and "Copy to SS Database". I am still not very good at access. Just started this database last year and have been working on it off and on. Any help would be great. Thanks.
 
Welcome to the Forum,

Take a look at MACROS in there you can do something like select record and then copy and then open another database or form and then add new record and then paste the copied record.

Which version of MS Access are you using?
 
I am using 2003.
 
Ok so I looked in the macros and holy macro I have no clue what I am doing. I made a control button that duplicates the record into the same form. I thought I could go into to design mode, right click on the button and click build event. Was going to edit the button to do what I wanted but I found out I don’t speak fluent access language. I hate asking for help over and over but I am much stumped.
 
In your database select the database window, near the bottom on the left is MACROS, click here.

Start a new macro, then in the actions (at the top)you will get a drop down, do the following:

Select the action

RunCommand in the bottom select SelectAll (This will select all the fields in your record)
Add the next action (At the top select the next empty action, then select

RunCommand in the bottom Copy

This will then copy the active record in your form, once we place the macro on your form.

Save the Macro as mcrCopyRecord.

Next open the form in design view and make sure you can see the database window then select your macro and drag it onto the form, this will create a button.

Now this is the first stage.

Next open your other database and open the form, then look to use Paste to see if this copies across the record, or use the Edit Menu and Paste.

If this works let me know and we will add the next stage.
 
Thanks so much Trevor. You got me going in the right direction. I couldnt get the SelectAll to work. It kept giving me an error. So I was playing around with the different settings and came up with this for the first macro.
RunCommand (have set to SelectRecord)
RunCommand (have set to Copy)
OpenForm (have set to PAST Iron Database)
RunCommand (have set to RecordsGoToLast)
RunCommand (have set to SelectRecord)
RunCommand (have set to Paste)
RunCommand (have set to Save)
Close (have set to PAST Iron Database)

For the second Macro.
RunCommand (have set to SelectRecord)
RunCommand (have set to Copy)
OpenForm (have set to Special Services Iron Database)
RunCommand (have set to RecordsGoToLast)
RunCommand (have set to SelectRecord)
RunCommand (have set to Paste)
RunCommand (have set to Save)
Close (have set to Blank Iron Sheets)

Everything seems to work. I do get the annoying pop up about the large amount of data on the clip board and if i want to keep it. But i can live with just clicking no.

Thanks agian for the help. I was getting frustated trying to figure it out on my own but after reading your reply you got me going in the right direction and it got actually fun working with database. Cant say thanks enough.
 
I'm confused by your post here. You say that you're

RunCommand (have set to SelectRecord)
RunCommand (have set to Copy)

OpenForm (have set to Special Services Iron Database)

RunCommand (have set to RecordsGoToLast)
RunCommand (have set to SelectRecord)
RunCommand (have set to Paste)

You're going to the last record, selecting it, then pasting the copied data into it. In other words, you're replacing the last record with the copied data, you're not creating a new record, which is your stated goal!

Instead of going to the last record, you need to go to a new record and then paste your copied data in.

Linq ;0)>
 
Rather than go to last record select to goto New Record as suggested by missinglinq.

If you are receiving the warning messages you can look to stop them by doing the following:

Select to insert a new row at the begining of your MACRO, then look for the action SetWarnings and you can turn the warnings Off, but please remember to put the warnings back on at the end so add another action at the end of the MACRO SetWarnings On.

Pleased to read you have a solution;)
 
missinglinq,
I tried the RecordGoToNew instead of RecordGoToLast and when I ran it it would popup an error like the error when I tried SelectAll (see attachment). When I open my form there is 5 records showing at the bottom. 1-4 are records with data. Number 5 is a blank new record. If I add data to number 5 and save number 6 shows up blank and new. So I am guessing when it goes to the last record it is a new blank record. I tested it and it is not copying over the last record with data. Which I am glad you brought that up because I sure didnt check that before. Thank you.

Trevor G,
Did the SetWarning and that takes care of the warnings.

Thanks to both of you.
 

Attachments

  • Noname (Small).jpeg
    Noname (Small).jpeg
    23.4 KB · Views: 93

Users who are viewing this thread

Back
Top Bottom