replicating a record: quick query.

G

Guest

Here is a code I have for replicating the last record. The button is
currently in the same subform in which I am entering records.

Private Sub TempSt_DblClick(Cancel As Integer)

With Me.RecordsetClone
.AddNew
!EmployeeID = Me.EmployeeID
!WeekID = DateAdd("d", 7, Me.WeekID)
!Dept = Me.Dept
!Subdept = Me.Subdept
!Costcentre = Me.Costcentre
!Rate = Me.Rate
!Contracthrs = 0
!timehalfhrs = 0
!doublehrs = 0
.Update
End With
DoCmd.GoToControl "Contracthrs"
DoCmd.GoToRecord , , acLast

End Sub

I have decided to move the button from the subform to the main form.

The main form is called "employee" and contains a subform called "department
subform" which contains the "department" form (where the buttons currently
reside).

I am not entirely sure what I have to replace "Me.Dept" with for it to be
successful (something straightforward).

Thanks in advance.
 
E

Eric Heinold

You should be able to change the Me.Dept to Me.[department
subform].Form!Dept

Eric Heinold
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top