PC Review


Reply
Thread Tools Rate Thread

NavigateTo Question

 
 
JamesJ
Guest
Posts: n/a
 
      2nd Feb 2008
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

 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      2nd Feb 2008
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:(E-Mail Removed)...
>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


 
Reply With Quote
 
 
 
 
JamesJ
Guest
Posts: n/a
 
      2nd Feb 2008
I'll do the macro.

Thanks much,
James

"Allen Browne" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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:(E-Mail Removed)...
>>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

>


 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      2nd Feb 2008
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:(E-Mail Removed)...
> I'll do the macro.
>
> Thanks much,
> James
>
> "Allen Browne" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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:(E-Mail Removed)...
>>>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.


 
Reply With Quote
 
New Member
Join Date: May 2012
Posts: 1
 
      30th May 2012
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
File Type: zip Navigation.zip (14.2 KB, 15 views)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
between question, question 1 is a 3, question 3 is a 1 Jose Cortez Microsoft Access 1 16th Jul 2009 07:45 AM
Perhaps and off topic question....but could use some help with video question.....I don't need codec help, just a general question. Bret Miller DIY PC 0 13th Oct 2006 12:23 AM
Registry question and a certificates question John C Windows XP Performance 0 23rd Apr 2004 01:58 PM
Question; strange things happening, please read inside(??] [2/2] - question.txt (1/1) exgi Windows XP Help 4 14th Apr 2004 12:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:33 PM.