Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Access (https://www.askmehelpdesk.com/forumdisplay.php?f=441)
-   -   When adding a button to a form, how do you inform the user to go to a specific field? (https://www.askmehelpdesk.com/showthread.php?t=338546)

  • Apr 6, 2009, 11:06 AM
    jakester
    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
  • Apr 6, 2009, 11:52 AM
    ScottGem
    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.

  • All times are GMT -7. The time now is 08:33 AM.