Results 1 to 4 of 4
  1. #1
    smorelandii is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    7

    Passing focus to subform.....

    I for the life of me can not seem to get the focus to pass to my subform. I have a main form with a few buttons and a datasheet subform. User enters data into the subform and clicks submit on the main form and the data is pushed to the appropriate tables. Need the foucus to be sitting in the 1st record, second column when the form opens. I've tried a number of things and can't seem to get it right. As usual, any and all comments are appriciated.



    Main Form = CELL_ROOM_1_ACID
    Sub Form = CELL_ROOM_1_ACID_SUB
    Focus field on Sub Form = fldConductivity

    Thanks.....

    - Steve

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Moving the focus the mainForm to a SubForm in code is a two step process.
    Me.SubFormControlName.SetFocus
    Me.SubFormControlName.FORM.ControlName.SetFocus
    ...remembering that the SubFormControlName need not be the same name as the SubForm it displays.

  3. #3
    smorelandii is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2011
    Posts
    7
    Thanks RuralGuy....... Got the issue resolved. The code below works..... My sub form displays table CELL_ROOM_1 but is named CELL_ROOM_1_ACID_SUB...... I was using the wrong name when referencing it.... Thanks you very much.... Issue resolved.

    Me!CELL_ROOM_1.SetFocus
    Me!CELL_ROOM_1.Form!fldConductivity.SetFocus

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Excellent! Glad we could help.

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

Similar Threads

  1. Replies: 15
    Last Post: 11-09-2010, 04:27 PM
  2. Replies: 1
    Last Post: 05-29-2010, 02:39 AM
  3. Setting Focus on a Form
    By MFeightner in forum Forms
    Replies: 1
    Last Post: 07-30-2009, 07:49 AM
  4. Set focus to another program
    By DrewB in forum Programming
    Replies: 1
    Last Post: 06-24-2009, 06:38 AM
  5. Keeping focus
    By ronatnc in forum Forms
    Replies: 0
    Last Post: 12-16-2008, 12:32 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