Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Posts
    2

    Unanswered: SetFocus problem

    Hope someone can assist with this irritating problem.

    I have a form (frmA) with a subForm (frmB). As the user moves through the various controls popups appears with the available options for that text box - txtTotalLength (eg for situation XYZ the values are 1,2 or 3). This popup is for information only as the user must enter the required option in the text box.

    I have the popup appearing on screen OK using an "on enter" event but I cannot set the focus back to the text box so the user can enter the appropriate value.

  2. #2
    Join Date
    Nov 2003
    Posts
    267
    Make it an After_Update Event

    S-

  3. #3
    Join Date
    Feb 2004
    Posts
    2
    Thank you for replying.

    I may not have made myself clear. The popup is to remain on screen until the user has entered the appropriate data in the control on the subform. Incidently the subforms (there are a number of them) are inside a tab control.

    After data is entered and the user moves to the next control the first popup is closed and another appears with information for the next textbox. The opening and closing of popups is working well, it is just getting the focus back to the subform control that is causing problems

    I tried using setfocus on a small test database and it worked perfectly.

    Private Sub Name_Enter()
    DoCmd.OpenForm "frmPopupWindow"
    Forms!frmTest.SetFocus
    End Sub

    When I tried used the main form and the subform that is in a tab control the focus remains with the popup until I click on the textbox. I am sure that I am not using the correct code to access this subform inside the tab control. Could you help with some suggested code to access the subform.

    Thanks again

  4. #4
    Join Date
    Nov 2003
    Posts
    1,487
    Just for the heck of it try this...
    Code:
    Private Sub Name_Enter()
       DoCmd.OpenForm "frmPopupWindow"
       Do.cmd.OpenForm "frmTest"
    End Sub


  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Hey Cyber...

    Isn't there something like uh.... PreviousControl.SetFocus or something like that? Well, that and referencing the form as well? I saw something like that and wasn't clear on how it was to be used. Just checking.
    Bud

  6. #6
    Join Date
    Nov 2003
    Posts
    1,487
    There most certainly is Bud, but I suppose it all depends upon what controls gain focus withing the Popup form itself when it loads and displays to which will really gain the Previous Control focus.

Posting Permissions

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