Ask Experts Questions for FREE Help !
Ask
    jakester's Avatar
    jakester Posts: 582, Reputation: 165
    Senior Member
     
    #1

    Apr 6, 2009, 11:06 AM
    When adding a button to a form, how do you inform the user to go to a specific field?
    Okay, I've created a data entry form in Access 2003. I included a click button for a user to add a new customer to the database. What I am trying to figure out how to do is once the user clicks on the button, the form should take the user to the first data entry field (where the blinking cursor should be). The code is partially working in that it will bring up a blank view of the form with no data present so I know I am about to add a new record. But if I am not familiar with form data entry, I may not know how to navigate around. I want to avoid this by forcing the cursor to go directly to the first data entry field so the user will know to start adding data there.

    This is what I have so far for code:

    Private Sub AddNewRecord_Click()

    DoCmd.GoToRecord, acNewRec


    End Sub

    Thanks for any suggestions.



    Jake
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Apr 6, 2009, 11:52 AM
    I would use:

    Private Sub AddNewRecord_Click()

    DoCmd.RunCommand acCmdRecordsGoToNew
    Me.controlname.SetFocus

    End Sub

    RunCommand is newer code used to execute a menu command so I would recommend getting used to used it then the older commands like GotoRecord. The SETFocus property of a control will cause it to gain focus.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search


Check out some similar questions!

About a field in Form 1040 NR-EZ ? [ 3 Answers ]

Hi Experts, I understand that last year I was suppose to file 1040 NR-EZ being on F1 status but I have incorrectly filed 1040 instead. I am filing the amended return this year. The question is that 1040 NR-EZ for this year asks about the return I have filed last year. So should I write 1040...

Form Header Field not Populating [ 2 Answers ]

Ok after fixing so many of my complex problems, I am stumpe on a fairly simple one. I have a subform with a header section to enter data in a couple of text boxes. One for Instructor and one for The name of the class. In the detail section I have continuous forms that each contain The two text...


View more questions Search