NavigateTo Question

J

JamesJ

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
 
A

Allen Browne

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.
 
J

JamesJ

I'll do the macro.

Thanks much,
James

Allen Browne said:
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

Reply to group, rather than allenbrowne at mvps dot org.

JamesJ said:
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
 
A

Allen Browne

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

Reply to group, rather than allenbrowne at mvps dot org.

JamesJ said:
I'll do the macro.

Thanks much,
James

Allen Browne said:
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 said:
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.
 
Top