Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513

    set focus to a contrel on a parent form from an evennt on the sub

    simple

    from an event on a subform (with no parent child relationship) I want to move focus to a control on the parent form
    i.e. when you click this cmd on the subform, an event happens, and focus moves to a control on the parent form...

    behind the sub, I thought this code would work:

    Private Sub cmdAccept_Click()


    <do stuff >
    With Forms![frmMainMenu].[cmdFixtureSchedulePrint]
    .Enabled = True
    .GotFocus = True ' <---- this line results in a "object doesn't support..." error
    End With
    Me.cmdAccept.Enabled = False

    -----------------------------------------
    many thanks in advance,
    mark

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It's .SetFocus, and no "= True"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513
    when all else fails... check the obvious
    (guess today should be one of these "no major decision" days!) LOL

    thanks

  4. #4
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    513
    which lead me to a new problem...

    I'm not able to disable the control whose event I'm in

    Private Sub cmdAccept_Click()
    ...
    With Forms![frmMainMenu].[cmdFixtureSchedulePrint]
    ...
    .setFocus
    End With
    Me.cmdAccept.Enabled = False

    I would think that since I've just set focus to another control, I
    t would be OK to disable this control (but maybe since I'm still in the event of that code, I can't)
    Would it make sense to move the code to disable cmdAccept to an event on the control I am moving focus to?
    and if so, behind which event should that be?

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    For anyone searching, the follow-up question is being discussed here:

    https://www.accessforums.net/forms/c...rol-36709.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. update parent form with child form info
    By kelkan in forum Forms
    Replies: 1
    Last Post: 07-04-2013, 02:51 PM
  2. Replies: 3
    Last Post: 07-03-2013, 01:20 PM
  3. Display info from parent form in child form
    By Leonidsg in forum Forms
    Replies: 3
    Last Post: 03-23-2013, 07:14 PM
  4. Passing value from parent to child form
    By Pragmatic in forum Forms
    Replies: 1
    Last Post: 12-02-2011, 07:23 PM
  5. run button on parent form
    By Mclaren in forum Programming
    Replies: 4
    Last Post: 04-28-2010, 01:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums