This has been posted before, but I need to get an answer to it as it is for a tight deadline project at work.
I have a Add New Record button, and code in an OnClick() event, as shown below. The thing is, when I click the button, it doesn't execute the DoCmd.GoToRecord , , acNewRec line, and I can't see why.
Here is my code in the OnClick() event:
I appreciate any help on this one, thanks
I have a Add New Record button, and code in an OnClick() event, as shown below. The thing is, when I click the button, it doesn't execute the DoCmd.GoToRecord , , acNewRec line, and I can't see why.
Here is my code in the OnClick() event:
Code:
Private Sub cmdNewSite_Click()
On Error GoTo Err_cmdNewSite_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FRM_PRIMARY"
DoCmd.OpenForm stDocName, , , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
DoCmd.Close acForm, "FRM_MENU" 'This is to shut the Menu down when I
'click the button
Exit_cmdNewSite_Click:
Exit Sub
Err_cmdNewSite_Click:
MsgBox Err.Description
Resume Exit_cmdNewSite_Click
End Sub
I appreciate any help on this one, thanks