last record upon form load

M

martiz

i have a create new button on a form and upon opening of form, i want it to
default to a new (blank) record. how do i do this?
 
D

Dan Dang

This code will open a form as a new record

Private Sub Command1_Click()
On Error GoTo Err_Command1_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "yourFormName"
DoCmd.Close
DoCmd.OpenForm stDocName, , stLinkCriteria, DataMode:=acFormAdd
Exit_Command1_Click:
Exit Sub
Err_Command1_Click:
MsgBox Err.Description
Resume Exit_Command1_Click
End Sub
 
Top