Set Focus to New Record

  • Thread starter Thread starter DD
  • Start date Start date
D

DD

Wayne Morgan thank you for response to my problem outlined
here. When I apply your solution which was to put
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec after the
button's code Me.AllowAdditions line. I get a message that
says: "The object "box" isn't open.

This is my original post: I have a form where allow
additions = false. A button called "Add New" can be
clicked and the code behind it is Me.AllowAdditions =
True. A new record then opens but I cannot find a way to
set focus to the new record. The form is continuous and it
contains only one text box which displays all of the
records in the form. I need to find a way to set the focus
to the record which contains no data.
 
I guess I have to ask where the button is located then and what other code
is in it's click event. I just tried the following in the click event of a
button in the Form Header of a continuous form and it worked just fine.

Private Sub Command4_Click()
Me.AllowAdditions = True
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
End Sub
 
Back
Top