Results 1 to 4 of 4
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    Setting the focus on a subform

    I have a form with 3 subforms. Depending on the value sent to the parent form I want to display certain controls on the subform and hide others. There is one control, a previously mentioned option group that I cannot hide. I get the following message.

    "You can't hide a control that has the focus."



    So I have tried to move the focus elsewhere like this.

    sbfrm_Ballot.Form.txt_Score.SetFocus

    Which generates this message.

    (This application) "can't move the focus to control 'txt_Score'."

    So I'm stuck and open for suggestion.

    Paul

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Don't think I have ever had to direct focus to a subform control. I read MS article says need to set focus to the subform container control first. I always name subform container control different from the form it contains, like: ctrBallot. Then refer to the textbox through the container.

    Me.ctrBallot.SetFocus
    Me.ctrBallot.Form.txt_Score.SetFocus
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    I'll try this tomorrow sometime.

    Thanks,

    Paul

  4. #4
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    I found the problem. The control I was trying to move the focus to was NOT enabled. I changed that and now it works. Thanks for your help.

    Paul

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

Similar Threads

  1. Set Focus on Subform
    By GCS in forum Forms
    Replies: 1
    Last Post: 12-01-2011, 11:46 AM
  2. Replies: 2
    Last Post: 09-12-2011, 11:11 AM
  3. Setting focus on a tabbed form
    By crowegreg in forum Forms
    Replies: 21
    Last Post: 08-27-2011, 09:22 AM
  4. Replies: 15
    Last Post: 11-09-2010, 04:27 PM
  5. Setting Focus on a Form
    By MFeightner in forum Forms
    Replies: 1
    Last Post: 07-30-2009, 07:49 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