problem with copy record code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form for users who frequently have a lot of duplicate information.
The duplicate record button would be ideal for this situation except for the
fact that they only have insert rights and not update rights and they need to
be able to make some changes to the new record.
So I've been trying to use some code provided by Klatuu but get an error
The code is:
Private Sub cmdCopyRec_Click()
Dim varCtls As Variant
Dim lngCtr As Long

'Build an array of the controls to copy
varCtls = Array("Buyer", "Type_Of_OR", "Trade_Made", "Lease_Sent")

'Loop throught the array and put the current value in the Tag

With Me
For lngCtr = 0 To UBound(varCtls)
.Controls(varCtls(lngCtr)).Tag = .Controls(varCtls(lngCtr)).Value
Next lngCtr
DoCmd.GoToRecord , , , acNewRec
For lngCtr = 0 To UBound(varCtls)
.Controls(varCtls(lngCtr)).Value = .Controls(varCtls(lngCtr)).Tag
Next lngCtr
End With

End Sub

The error occurs at line:
.Controls(varCtls(lngCtr)).Tag = .Controls(varCtls(lngCtr)).Value

I am using Access 2003. Is the controls property available to me?
Thanks
 
Back
Top