RE: On Click - open to new record

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



That was it!

Thanks again!

--
www.Marzetti.com


"Klatuu" wrote:

My typo
adDataForm should be acDataForm
I can't be sure that is the problem, but try that.
This is in the Load event of the form frmComplaints, right?
--
Dave Hargis, Microsoft Access MVP


"JohnLute" wrote:

DoCmd.GoToRecord adDataForm, Me.Name, acNewRec
--
www.Marzetti.com


"Klatuu" wrote:

I don't see a problem with the code. On what line do you get the error?
--
Dave Hargis, Microsoft Access MVP


"JohnLute" wrote:

"Klatuu" wrote:

Post back with the code as it is now, please.

Button:
Private Sub OpenComplaints_Click()
On Error GoTo Err_OpenComplaints_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmComplaints"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , , "New"

Exit_OpenComplaints_Click:
Exit Sub

Err_OpenComplaints_Click:
MsgBox Err.Description
Resume Exit_OpenComplaints_Click

End Sub

Form:
Private Sub Form_Load()
If Me.OpenArgs = "New" Then
DoCmd.GoToRecord adDataForm, Me.Name, acNewRec
End If

End Sub
.


Quantcast