Results 1 to 6 of 6
  1. #1
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215

    Changing Navigation Target Names via VBA within Navigation Form

    Hi,



    I have a Navigation Form with Tabs. To specify what subform gets loaded within the Navigation Form when you click a Tab, you select a specific Navigation Target Name.

    I was curious if anyone knew how to call this option in VBA so that I can switch between forms under one particular Tab. That is, ideally, if I click a button, it switches to a different form under the same particular Tab. I believe this can be done by changing Navigation Target Names and refreshing.

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    On the TAB.CHANGE event:

    Code:
    Private Sub tab1_Change()
    'MsgBox tab1.Value
    Select Case tab1.Value
        Case 1
           SubForm.SourceObject = "frmSubEmp"
        Case 2
           SubForm.SourceObject = "frmSubPHONES"
    End Select
    End Sub

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    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.

  4. #4
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215
    Thanks for the input guys. Unfortunately, I don't think these replies address the issue.

    Instead of changing Tabs on the Main Navigation form, I want the button to change the Navigation Target Name for that particular Tab. That is

    I want the current subform to close and another subform to be loaded ALL WITHIN THE CURRENT TAB. I was thinking this could be done by changing the Navigation Target Name and refreshing the forms, but it didn't work.

    You can call upon the Navigation Target Name in VBA, but it doesn't really work like I want it to. It's not the refreshing part either that's screwing up since I use sendkeys F9

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    This is easy with a regular form/subform, whether or not a Tab control is involved. ranman's code should work for that situation, although not sure the Change event is appropriate.

    I don't like nor use Navigation form. The referenced links are all I can offer.
    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.

  6. #6
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215
    The only reasonable work-around that I can think of is by setting the elements of a form visible or not visible and giving the illusion of two (or more) different forms. It works for subforms within the Tab, actually. You can turn these subforms visible or not visible - just not the main subform within the Tab (ie, the Tab Navigation Target). You can have one main Tabbed form and set subforms within it that you turn off and on with control sources. I would suggest taking this route with the next person that inquires about it.

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

Similar Threads

  1. Replies: 12
    Last Post: 10-23-2014, 02:08 AM
  2. Replies: 2
    Last Post: 08-09-2014, 04:27 AM
  3. Replies: 3
    Last Post: 08-29-2013, 02:10 AM
  4. Navigation Form
    By WayneSteenkamp in forum Access
    Replies: 3
    Last Post: 03-04-2012, 03:35 AM
  5. Navigation Form
    By Roger81 in forum Forms
    Replies: 2
    Last Post: 07-21-2011, 01:33 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