Results 1 to 4 of 4

Thread: Set Focus

  1. #1
    Join Date
    Jun 2010
    Posts
    186

    Unanswered: Set Focus

    I have created a YES/NO form to open after new record entry on a main form. MainForm opens in Add Mode.
    MainForm has a tab control with 2 pages, Page49 and Page50. Page49 has subform1 and subform2 on it that require data, and Page50 has subform3 with optional fields. To loop around the optional fields - the Mainform is designed so tabs and focus bring you from MainForm new record to TabCtl Page49, subform1 new record, subform2 new record........all the way through to last field

    The last field of subform2 brings up this Yes/No form. Yes button is supposed to return you to the MainForm, into TabCtl Page50......

    Having trouble with this syntax on the Yes button. The YES/NO form does close and it brings me back to the MainForm...but it looses focus.

    How do I fix this DoCmd to take you into TabCtl Page50?
    (Subform3 already has OnEnter - DoCmd.GoToRecord , , acNewRec so I think I just need to get on Page50)

    Private Sub btnYES_Click()
    On Error GoTo Err_btnYES_Click
    DoCmd.Close acForm, "YES/NO"
    Forms!MainForm.SetFocus
    DoCmd.GoToControl "TabCtl"


    Exit_btnYES_Click:
    Exit Sub

    Err_btnYES_Click:
    MsgBox Err.Description
    Resume Exit_btnYES_Click

    End Sub

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Try

    Forms!MainForm.Page50.SetFocus
    Paul

  3. #3
    Join Date
    Jun 2010
    Posts
    186
    worked!! thank you Paul!

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Ah good, glad it worked for you.
    Paul

Posting Permissions

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