Calculating & Recalculating

upon Edit (OnDirty) access should copy the current information in the SubForm then create a new record and paste the copied data into a new record(form).

this is my current code but it doesnt work on the SubForm, i'm assuming its because the subForm is Query Based.

Private Sub Form_Dirty(Cancel As Integer)
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.GoToRecord , , acNewRec
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
 
On Dirty happens the moment you change anything. So this even is too soon. Try Form Before Update.

In you code you select the record twice. Try it without the second of these. Secodn last line.

Problem is that you will end up with two records the same if this works.
 
thanks, the idea is to have 2 of the same records.
 
I can't see why you would want two of the same records.

You might have problems with your copy because you may be trying to copy the Primary Key. Access will only allow one record with the same value of the Primary Key or you may also have other fields that do not allow duplicates.
 

Users who are viewing this thread

Back
Top Bottom