<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2722.900" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Rocky,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>CommandBars is a property of
Access.Application object (default instance) - so there is no any need to search
for "(hundreds) of registered references" - the code just gets the object ref
(memory address) of already created collection
Access.Application.CommandBars . Commandbars is a collection i.e. it supports
COM's standard Collection interface(_NewEnum, Add, Remove, Item, Count) +
it has its own interface including FindControl method. Because of late binding
FindControl is called via IDispatch COM interface of CommandBars coclass.
IDispatch interface has GetIdsOfNames method, which is used to find the numeric
Id of FindControl method. The info for IDispatch is stored in type library - for
CommandBars this typelibrary is included into MS Office object library. Each
version of MS Access "knows" its own version of MS Office type library -
e.g. here is how MS Access 2000 "gets knowledge" that its
Commandbars object is from MS Office 9.0 Object library:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>// typelib filename: msacc9.olb</FONT></DIV>
<DIV><FONT face=Arial size=2>[<BR>
uuid(4AFFC9A0-5F99-101B-AF4E-00AA003F0F07),<BR> version(9.0),<BR>
helpstring("Microsoft Access 9.0 Object Library"),<BR>
helpfile("acmain9.chm"),<BR> helpcontext(00000000)<BR>]<BR>library
Access<BR>{<BR> // TLib : // TLib :
Microsoft Visual Basic for Applications Extensibility 5.3 :
{0002E157-0000-0000-C000-000000000046}<BR>
importlib("VBE6EXT.OLB");<BR> // TLib : Microsoft ActiveX Data
Objects 2.1 Library :
{00000201-0000-0010-8000-00AA006D2EA4}<BR>
importlib("msado21.tlb");<BR> // TLib : Microsoft Office 9.0
Object Library : {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}<BR>
importlib("MSO9.DLL");<BR></FONT><FONT face=Arial size=2>....</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>- importlib("MSO9.DLL") statement creates this
static link in MS Access Object Library. IDispatch uses MS Office Object Library
GUID ({2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} for MS Office 9) statically written
to MS Access object library to get (via system registry) location of MS Office
Object library file, loads this object library and its typelib and finds numeric
ID of FindControl method. </FONT><FONT face=Arial size=2>Then marchalling is
used to create parameters array and Fincontrol method is called using Invoke
method of IDispatch interface... (It may happen that MS Office type library gets
preloaded on MS Access start-up - I don't know these internal details but the
nature of COM is to activate a feature/create object instances on first call to
them only not in advance - so I guess that MS Office Object library is loaded
when CommandBars collection is created during MS Access start-up or on first
call to CommandBars collection, which can be the call from your
code...)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>It looks a little bit complicated but it doesn't
take that much time to care about or see any difference with early binding for
two late bound calls as in your case...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Hope this explains some late binding internal
details,</FONT></DIV>
<DIV><FONT face=Arial size=2>Shamil</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>----- Original Message ----- </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=bchacc@san.rr.com href="mailto:bchacc@san.rr.com">Rocky Smolin -
Beach Access Software</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, February 05, 2003 12:21
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [AccessD] Office 10.0
Library vs. Office 9.0 Library</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Shamil and Bryan:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks so much. That was way too easy,
:)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>But how does the program know which library to go
to without searching all of those (hundreds) of registered
references?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I don't notice any pause at all.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Best,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Rocky Smolin<BR>Beach Access
Software</FONT></DIV>
<DIV> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=shamil@smsconsulting.spb.ru
href="mailto:shamil@smsconsulting.spb.ru">Shamil Salakhetdinov</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, February 04, 2003 12:11
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [AccessD] Office 10.0
Library vs. Office 9.0 Library</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>> How can I convert this to late
binding?</FONT></DIV>
<DIV><FONT face=Arial size=2>Rocky,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>This is easy - just use this code:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Dim cbc As Object ' CommandBarControl<BR>Set
cbc = CommandBars("Menu Bar").FindControl(ID:=4,
recursive:=True)<BR>cbc.Enabled = False</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>and remove the reference to the MS
Office object library.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>HTH,</FONT></DIV>
<DIV><FONT face=Arial size=2>Shamil</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=bchacc@san.rr.com href="mailto:bchacc@san.rr.com">Rocky Smolin -
Beach Access Software</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, February 04, 2003
10:35 PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [AccessD] Office 10.0
Library vs. Office 9.0 Library</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Shamil:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I'm having a little trouble finding enough
help in Help and the ADH to figure out how to do late binding. I'm
currently using the following three lines to turn off the print
button:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Dim cbc As CommandBarControl<BR>Set cbc =
CommandBars("Menu Bar").FindControl(ID:=4, recursive:=True)<BR>cbc.Enabled
= False<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>How can I convert this to late
binding?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>(BTW, I'm trying to repair my Office
installation now. Maybe it will get rid of Version 10 and replace it
with Version 9 which will solve the problem.)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Best,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Rocky</FONT></DIV>
<DIV><FONT face=Arial size=2> </DIV></FONT>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=shamil@smsconsulting.spb.ru
href="mailto:shamil@smsconsulting.spb.ru">Shamil Salakhetdinov</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=accessd@databaseadvisors.com
href="mailto:accessd@databaseadvisors.com">accessd@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, February 04, 2003
10:25 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [AccessD] Office 10.0
Library vs. Office 9.0 Library</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Rocky,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The only stable solution I know is to use
late binding - then you'll not need a reference to Office 9 or
10.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>HTH,</FONT></DIV>
<DIV><FONT face=Arial size=2>Shamil</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=bchacc@san.rr.com href="mailto:bchacc@san.rr.com">Rocky
Smolin - Beach Access Software</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=AccessD@databaseadvisors.com
href="mailto:AccessD@databaseadvisors.com">AccessD@databaseadvisors.com</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, February 04, 2003
7:30 PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [AccessD] Office 10.0
Library vs. Office 9.0 Library</DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2>Dear List:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>In order to turn off the print button on
the file menu I used the CommandBar object which required the Office
Library. I have Version 10.0. My customer, however, has
Version 9.0. He doesn't have 10.0. I don't have 9.0.
So now in the update we have to uncheck the 10.0 (missing) library,
and check the 9.0 library. Awkward phone support at best.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>What's the best way around this?
Can I get 9.0? Or can he get 10.0? Or what? They're
running Office 2000. Pro, I believe.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>MTIA</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Rocky Smolin<BR>Beach Access
Software</FONT></DIV>
<DIV><FONT face=Arial
size=2></FONT> </DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>