Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    64

    Unanswered: Go to FirstName field when clicked Add New

    How do I set focus or go to a certain field,(eg: FirstName) field when click "Add New" button?

    I have a "contacts" form, and a "orders" subform in the "contacts" form. I need the user to be able to go from any field in orders subform to the firstname field in the contacts form when they click the "add new" button.

    Where should I add the "FirstName.SetFocus" in the below code?

    Private Sub AddContactCommand87_Click()
    On Error GoTo Err_AddContactCommand87_Click

    DoCmd.GoToRecord , , acNewRec
    SalesRepCombo.Value = gstrSalesRep

    Exit_AddContactCommand87_Click:
    Exit Sub

    Err_AddContactCommand87_Click:
    MsgBox Err.Description
    Resume Exit_AddContactCommand87_Click

    End Sub

    Thanks

  2. #2
    Join Date
    Jan 2004
    Posts
    64
    I figured it out. Here it is.
    Thanks all.
    Private Sub AddContactCommand87_Click()
    On Error GoTo Err_AddContactCommand87_Click

    DoCmd.GoToRecord , , acNewRec
    SalesRepCombo.Value = gstrSalesRep
    [FirstName].SetFocus
    Exit_AddContactCommand87_Click:
    Exit Sub

    Err_AddContactCommand87_Click:
    MsgBox Err.Description
    Resume Exit_AddContactCommand87_Click

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •