Button to copy prev entry

  • Thread starter Thread starter DBru
  • Start date Start date
D

DBru

I need some code to put on a button of a form that will allow it to copy the
information from the previous entry. This is something that I don't want to
happen every new entry but just on the click of the button. It will be
pulling information from a single table.
 
I need some code to put on a button of a form that will allow it to copy the
information from the previous entry. This is something that I don't want to
happen every new entry but just on the click of the button. It will be
pulling information from a single table.

While the 'previous record' is being displayed on the form ...
Code the click event of a command button:

' Save the current record
DoCmd.RunCommand acCmdSaveRecord
' Select the current record
DoCmd.RunCommand acCmdSelectRecord
' Copy the selected record
DoCmd.RunCommand acCmdCopy
' Paste append the record as a new record
DoCmd.RunCommand acCmdPasteAppend
 
When I used this I ended up getting multiple entries. In my setup I would
like to copy data that is on a sub-sub form.

Main form is Entities; subform is Properties, sub-subform is Insurance.
Essentially, one Entity (not duplicative) can have many Properties (not
duplicative) each of which could have multiple year's of Insurance
information.

The data on the sub-subform Insurance is what changes each year, however
some of the data may stay the same. I want to copy the previous year's
insurance data for a specific Property for a specific Entity and create it as
a new record under its Entity/Property relation. After trying some of the
suggestions here, I am getting multiple entries for a single record when I
try to copy it.

This probably isn't clear, but it is the best way I know how to explain it.
Thanks for any assistance.

Ember
 
Back
Top