Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008
    Posts
    150

    Unanswered: How do you set focus from one form to another?

    Hello,

    I would like to modify the wizard code below to set focus on a control located on my main input form.

    Example: I have an Input_Service_Form with a button to a Notes form. After I have entered my notes and close the Notes form, I would like to return focus on a control (cboServiceType) located on my main input form (Input_Service_Form). The code below is not working.

    <BEGIN CODE>
    Private Sub Close_Notes_Button_Click()
    On Error GoTo Err_Close_Notes_Button_Click

    DoCmd.Close
    Forms!Input_Service_Form!cboServiceType.SetFocus

    Exit_Close_Notes_Button_Click:
    Exit Sub

    Err_Close_Notes_Button_Click:
    MsgBox Err.Description
    Resume Exit_Close_Notes_Button_Click

    End Sub
    <END CODE>

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    This is stange, it seems to work here (see attached file).

    Have a nice day!
    Attached Files Attached Files

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    I think there is a form/report object level command which switches the focus, but I have never needed it, so the command eludes me.

    Form.Activate comes to mind, but I think that might be VB6
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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