Full Version: Copy & Paste Record in form (Duplicate Record) ?
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
JoeOxfordCT
Good Morning !

I have a continuous records form with approx 10 fields. I have a button in each record to duplicate that record. Now most of the fields in the form are locked and I've had to unlock the fields - do the copy & paste - and then relock them...that part works fine.

Now however, I also have a couple of fields that I've made not visible. When I do the copy and paste the non-visible fields do not populate in the new record ? These are key fields that I need but have chosen to hide because they're the same for every record and also to conserve screen space. I'm using the canned code to duplicate the record which seems a bit clunky too...here it is:

CODE
Private Sub Command51_Click()
On Error GoTo Err_Command51_Click

    Me.CLAIM_NO.Locked = False
    Me.MemberNum.Locked = False
    Me.MemberName.Locked = False
    Me.DOS.Locked = False
    Me.SUFFIX.Locked = False
    Me.Leftover.Locked = False
    Me.MED.Locked = False
    Me.RECEIPIENT.Locked = False
    Me.TaxID.Locked = False
    Me.ORIG_AMT.Locked = False
    
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
    
    Me.CLAIM_NO.Locked = True
    Me.MemberNum.Locked = True
    Me.MemberName.Locked = True
    Me.DOS.Locked = True
    Me.SUFFIX.Locked = True
    Me.Leftover.Locked = True
    Me.MED.Locked = True
    Me.RECEIPIENT.Locked = True
    Me.TaxID.Locked = True
    Me.ORIG_AMT.Locked = True
    
    Me.Requery
    
Exit_Command51_Click:
    Exit Sub

Err_Command51_Click:
    MsgBox Err.Description
    Resume Exit_Command51_Click
    
End Sub


Any suggestions or workarounds ?
MStef
Hello Joe!
Good Morning!
Why do you want to duplicate a record ???
You don't need the same record in MDB, (especially not in the same table).
It means that you have to learn something about DATABASE NORMALIZATION.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.