I am trying to open a form and pass the LastName from the open form to the new form. My code is as follows. When I run it I get Name# in the Last Name box.
Private Sub Command10_Click()
Dim strLastName As String
strLastName = Me.txtLastName
DoCmd.Close acForm, "frmStaff"
DoCmd.OpenForm "frmStaffNew"
DoCmd.GoToRecord , , acNewRec
Forms!frmStaffNew!txtLastName.DefaultValue = strLastName
Anyone know what I'm doing wrong?
Private Sub Command10_Click()
Dim strLastName As String
strLastName = Me.txtLastName
DoCmd.Close acForm, "frmStaff"
DoCmd.OpenForm "frmStaffNew"
DoCmd.GoToRecord , , acNewRec
Forms!frmStaffNew!txtLastName.DefaultValue = strLastName
Anyone know what I'm doing wrong?