Results 1 to 6 of 6
  1. #1
    Ann Robey is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    3

    Question Tab Control between subforms and forms and between Command Buttons and forms

    I have a navigation form that displays a form (Contacts) with three subforms (EventsAttended, LettersSent, and Notes) that are based on the one-to-many relationships between Contacts and the other three tables. The Contacts form has Command Buttons for Find, AddNew and Delete.
    Problems:


    1. When I click on the AddNew command button, the cursor remains on that button. I would prefer that it go to the first field (top of the tab order) in the Contacts form. How do I make that happen?
    2. I would like the cursor to tab to the first field in the Contacts form after adding a record in any one of the subforms. This will enable a subsequent Find or Delete without having to manually reset the cursor. How do I do that?

    I have worked quite a bit as a novice with Access but not with coding in Visual Basic or building macros so need some help if these functions require me to do either.
    Thanks for any help you can provide.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,901
    For no. 1: A click does not emulate the tab key action so the control clicked on retains focus. You can either manually tab from the button or use code in the button click event to set focus on another control. I use only VBA.
    Me.controlname.SetFocus

    For no. 2: I've never done this. Is the subform in Continuous or Datasheet view? Maybe in the subform AfterUpdate event, use the SetFocus method.
    Forms!mainformname!controlname.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
    Ann Robey is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    3
    Each of the subforms is in continuous view.
    Perhaps someone can help with macro language that would work?
    Thanks.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,901
    Google: Access macro SetFocus

    Does this help http://support.microsoft.com/kb/209689?wa=wsignin1.0
    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.

  5. #5
    Ann Robey is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    3
    Thanks, that worked perfectly to redirect focus from a control button to the the field where I wanted it (problem #1).

    However, when I tried the same thing to move from a subform to a specified field in the primary form I got the message that "there is no field "frmContacts Form" in the current record. It appears that the macro did not redirect focus from the subform to the primary form before attempting to put focus on the field I requested. What am I missing?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,901
    I don't use macros, only VBA.

    I would have to view the macro settings. Either post them (so much easier to post VBA code) or the database.
    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.

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

Similar Threads

  1. VBA coding for forms and command buttons
    By bakerri2 in forum Access
    Replies: 1
    Last Post: 05-31-2012, 11:29 AM
  2. Replies: 5
    Last Post: 10-27-2011, 01:00 PM
  3. Help with Forms and Subforms
    By xstaceyid in forum Forms
    Replies: 1
    Last Post: 04-21-2011, 02:14 PM
  4. Command buttons to Open Forms
    By Ace Pioneer in forum Access
    Replies: 1
    Last Post: 11-30-2010, 06:32 AM
  5. Replies: 2
    Last Post: 04-11-2006, 08:40 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