G
Guest
Hello,
Can someone please tell me why my code isn't working. I have a subform
within a main form. When the user wants to edit existing data, they click on
the Edit button, where I have a dialog form popping up asking for the user
name and current date. This works fine. I have the below listed code
attached to the OK button, which is not working.
Can someome help me?
Thanks.
Private Sub cmdOK_Click()
On Error GoTo Err_cmdOK_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmADD_LEAK_SUBFORM"
stLinkCriteria = "[LEAKID]=" & "'" & Me![LEAKID] & "'"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, Me.Name
DoCmd.GoToRecord stDocName, , , stLinkCriteria
Exit_cmdOK_Click:
Exit Sub
Err_cmdOK_Click:
MsgBox Err.Description
Resume Exit_cmdOK_Click
End Sub
Can someone please tell me why my code isn't working. I have a subform
within a main form. When the user wants to edit existing data, they click on
the Edit button, where I have a dialog form popping up asking for the user
name and current date. This works fine. I have the below listed code
attached to the OK button, which is not working.
Can someome help me?
Thanks.
Private Sub cmdOK_Click()
On Error GoTo Err_cmdOK_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmADD_LEAK_SUBFORM"
stLinkCriteria = "[LEAKID]=" & "'" & Me![LEAKID] & "'"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, Me.Name
DoCmd.GoToRecord stDocName, , , stLinkCriteria
Exit_cmdOK_Click:
Exit Sub
Err_cmdOK_Click:
MsgBox Err.Description
Resume Exit_cmdOK_Click
End Sub