NavigateTo Question

Discussion in 'Microsoft Access Forms' started by JamesJ, Feb 1, 2008.

  1. JamesJ

    JamesJ Guest

    2 thing of interest here.
    This is apparently wrong 'cause I'm getting a compile error:
    DoCmd.NavigateTo([Custom], [Data01]) Expected =

    1) While I type it in the Auto Data Tips (I think that's what it is called)
    is Showing the following:
    DoCmd.NavigateTo([Category], [Group])

    2) When I do vb help for the NavigateTo Method it's example is:
    DoCmd.NavigateTo(Category, Group) minus the brackets being
    shown in the Auto Data Tips.

    What is the proper sysntax? The Category is Custom and the Group is Data01.

    Thanks,
    James
     
    JamesJ, Feb 1, 2008
    #1
    1. Advertisements

  2. JamesJ

    Allen Browne Guest

    James, I will check into this further, but a cursory glance suggests that
    the NavigateTo method is faulty.

    It's a new method of the DoCmd object in A2007, for manipulating the
    Navigation Pane. The NavigateTo action in a macro works okay. If you show
    the Arguments column in macro design, you see arguments such as
    acNavigationCategoryObjectType, acNavigationGroupTables

    If you then open the Object Browser (F2 in the code window), show hidden
    members (right-click) and search for acNavigationCategoryObjectType, it
    doesn't exist. Similarly, if you ask this in the Immediate Window:
    ? TypeName(acNavigationCategoryObjectTy)
    the response is Empty, indicating it is an uninitialized variant, i.e. VBA
    does not recognise it as a defined constant.

    So, it appears that the constants are not correctly declared for use in VBA
    code.

    The only way I can see that you can call them programatically at this point
    would be RunMacro.

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "JamesJ" <jjy@darwin_roadrunner.com> wrote in message
    news:...
    >2 thing of interest here. This is apparently wrong 'cause I'm getting a
    >compile error:
    > DoCmd.NavigateTo([Custom], [Data01]) Expected =
    >
    > 1) While I type it in the Auto Data Tips (I think that's what it is
    > called)
    > is Showing the following:
    > DoCmd.NavigateTo([Category], [Group])
    >
    > 2) When I do vb help for the NavigateTo Method it's example is:
    > DoCmd.NavigateTo(Category, Group) minus the brackets being
    > shown in the Auto Data Tips.
    >
    > What is the proper sysntax? The Category is Custom and the Group is
    > Data01.
    >
    > Thanks,
    > James
     
    Allen Browne, Feb 2, 2008
    #2
    1. Advertisements

  3. JamesJ

    JamesJ Guest

    I'll do the macro.

    Thanks much,
    James

    "Allen Browne" <> wrote in message
    news:...
    > James, I will check into this further, but a cursory glance suggests that
    > the NavigateTo method is faulty.
    >
    > It's a new method of the DoCmd object in A2007, for manipulating the
    > Navigation Pane. The NavigateTo action in a macro works okay. If you show
    > the Arguments column in macro design, you see arguments such as
    > acNavigationCategoryObjectType, acNavigationGroupTables
    >
    > If you then open the Object Browser (F2 in the code window), show hidden
    > members (right-click) and search for acNavigationCategoryObjectType, it
    > doesn't exist. Similarly, if you ask this in the Immediate Window:
    > ? TypeName(acNavigationCategoryObjectTy)
    > the response is Empty, indicating it is an uninitialized variant, i.e. VBA
    > does not recognise it as a defined constant.
    >
    > So, it appears that the constants are not correctly declared for use in
    > VBA code.
    >
    > The only way I can see that you can call them programatically at this
    > point would be RunMacro.
    >
    > --
    > Allen Browne - Microsoft MVP. Perth, Western Australia
    > Tips for Access users - http://allenbrowne.com/tips.html
    > Reply to group, rather than allenbrowne at mvps dot org.
    >
    > "JamesJ" <jjy@darwin_roadrunner.com> wrote in message
    > news:...
    >>2 thing of interest here. This is apparently wrong 'cause I'm getting a
    >>compile error:
    >> DoCmd.NavigateTo([Custom], [Data01]) Expected =
    >>
    >> 1) While I type it in the Auto Data Tips (I think that's what it is
    >> called)
    >> is Showing the following:
    >> DoCmd.NavigateTo([Category], [Group])
    >>
    >> 2) When I do vb help for the NavigateTo Method it's example is:
    >> DoCmd.NavigateTo(Category, Group) minus the brackets being
    >> shown in the Auto Data Tips.
    >>
    >> What is the proper sysntax? The Category is Custom and the Group is
    >> Data01.
    >>
    >> Thanks,
    >> James

    >
     
    JamesJ, Feb 2, 2008
    #3
  4. JamesJ

    Allen Browne Guest

    Actually, it turns out that my initial guess was wrong.

    The names such as acNavigationCategoryObjectType and acNavigationGroupTables
    are not meant to be constants. They are the literal strings that NavigateTo
    expects.

    So DoCmd.NavigateTo does work in code, if you use those names in quotes. The
    help topic doesn't explain this, so you need to mock up a macro with the
    desired choices, and display them in the macro names argument. You can then
    copy these names as string into your code.

    Strange one! Certainly not well documented.

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "JamesJ" <jjy@darwin_roadrunner.com> wrote in message
    news:...
    > I'll do the macro.
    >
    > Thanks much,
    > James
    >
    > "Allen Browne" <> wrote in message
    > news:...
    >> James, I will check into this further, but a cursory glance suggests that
    >> the NavigateTo method is faulty.
    >>
    >> It's a new method of the DoCmd object in A2007, for manipulating the
    >> Navigation Pane. The NavigateTo action in a macro works okay. If you show
    >> the Arguments column in macro design, you see arguments such as
    >> acNavigationCategoryObjectType, acNavigationGroupTables
    >>
    >> If you then open the Object Browser (F2 in the code window), show hidden
    >> members (right-click) and search for acNavigationCategoryObjectType, it
    >> doesn't exist. Similarly, if you ask this in the Immediate Window:
    >> ? TypeName(acNavigationCategoryObjectTy)
    >> the response is Empty, indicating it is an uninitialized variant, i.e.
    >> VBA does not recognise it as a defined constant.
    >>
    >> So, it appears that the constants are not correctly declared for use in
    >> VBA code.
    >>
    >> The only way I can see that you can call them programatically at this
    >> point would be RunMacro.
    >>
    >> "JamesJ" <jjy@darwin_roadrunner.com> wrote in message
    >> news:...
    >>>2 thing of interest here. This is apparently wrong 'cause I'm getting a
    >>>compile error:
    >>> DoCmd.NavigateTo([Custom], [Data01]) Expected =
    >>>
    >>> 1) While I type it in the Auto Data Tips (I think that's what it is
    >>> called)
    >>> is Showing the following:
    >>> DoCmd.NavigateTo([Category], [Group])
    >>>
    >>> 2) When I do vb help for the NavigateTo Method it's example is:
    >>> DoCmd.NavigateTo(Category, Group) minus the brackets being
    >>> shown in the Auto Data Tips.
    >>>
    >>> What is the proper sysntax? The Category is Custom and the Group is
    >>> Data01.
     
    Allen Browne, Feb 2, 2008
    #4
  5. JamesJ

    markforsyth

    Joined:
    May 30, 2012
    Messages:
    1
    Likes Received:
    0
    I have been toiling with the NavigateTo method and thanks to a Google Book discovered the correct syntax. I created a small form with a button for the most common objects. As I click each button, the various objects appear in the Navigation Pane. Here is the code behind the buttons. Note that I had to make sure the Pane was maximised before displaying the objects. I also added buttons to show all the objects and to hide the Pane. It works a treat and is handy if you have a lot of tables, queries etc. I also attach a database with the Form if anyone wants to use/amend it.

    Private Sub Command0_Click()
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.Maximize
    DoCmd.NavigateTo "acNavigationCategoryObjectType", "acNavigationGroupTables"
    End Sub
    Private Sub Command2_Click()
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.Maximize
    DoCmd.NavigateTo "acNavigationCategoryObjectType", "acNavigationGroupQueries"
    End Sub
    Private Sub Command3_Click()
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.Maximize
    DoCmd.NavigateTo "acNavigationCategoryObjectType", "acNavigationGroupForms"
    End Sub
    Private Sub Command4_Click()
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.Maximize
    DoCmd.NavigateTo "acNavigationCategoryObjectType", "acNavigationGroupMacros"
    End Sub
    Private Sub Command5_Click()
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.Maximize
    DoCmd.NavigateTo "acNavigationCategoryObjectType", "acNavigationGroupModules"
    End Sub
    Private Sub Command6_Click()
    DoCmd.NavigateTo "acNavigationCategoryObjectType" ' All Objects
    DoCmd.Maximize
    End Sub
    Private Sub Command7_Click()
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.Maximize
    DoCmd.NavigateTo "acNavigationCategoryObjectType", "acNavigationGroupReports"
    End Sub
    Private Sub Command8_Click()
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.Minimize
    End Sub
    Private Sub Form_Load()
    DoCmd.MoveSize 0, 0, , 850
    End Sub
     

    Attached Files:

    markforsyth, May 30, 2012
    #5
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Thomas

    Calculated Field - newbie question.

    Steve Thomas, Jun 28, 2003, in forum: Microsoft Access Forms
    Replies:
    6
    Views:
    726
    Mike Painter
    Jun 30, 2003
  2. Microsoft

    An expression question on dates

    Microsoft, Jun 29, 2003, in forum: Microsoft Access Forms
    Replies:
    6
    Views:
    520
    Allen Browne
    Jul 6, 2003
  3. paul

    Check box validaion question (basic question)

    paul, Dec 1, 2003, in forum: Microsoft Access Forms
    Replies:
    1
    Views:
    222
    Guest
    Dec 3, 2003
  4. Guest

    Forms Question or Query Question..

    Guest, Oct 1, 2005, in forum: Microsoft Access Forms
    Replies:
    0
    Views:
    193
    Guest
    Oct 1, 2005
  5. Guest

    Relationship Question and follow up form question

    Guest, Mar 9, 2007, in forum: Microsoft Access Forms
    Replies:
    0
    Views:
    228
    Guest
    Mar 9, 2007
Loading...

Share This Page