A2K7 RT & references

A

Albert D. Kallal

Based on your experience and expertise, should I work with coding or late
binding to try to reduce the later four references even further? Perhaps
using late binding would be a good learning experience. Douglas has given
some good guidance on doing this. Any comments anyone?

For some of the built in references such as code using dao, or ado, you
really can't avoid using a reference in these cases. I suppose one could
attempt to use some late binding for some of their ADO code but for the most
part if you using dao , or ado, you NEED that reference. It's really not
possible or practical to attempt development without these references in
place.

So the general rule of thumb the suggestion is to create an blank database,
and look at the minimal references you need to run. As several others have
said here, most of us never add any references at all, and that usually is
because we're using dao which is already included as a reference by default.
so, one should not add an reference unless we absolutely have to.

You could perhaps consider removing the reference that allows you to run the
ribbons code, and late binding that, but I don't think that's even likely
worth the effort. The real goal and reason why we use late binding is
because we're going to be installing software on a machine that may not have
that particular software we are talking about. For all intents and purposes
your target machine is going to have your basic code and reffernces that
allows ADO and the ribbion to run.

However the person might not have a outlook installed. Hence, if you added a
nice e-mail button to your custom report ribbion that allows one to click
while viewing the reprot and the report is then made into a pdf, and then
the email is launched with that report already attached as a pdf is a handy
feature. However some of your customers using the application might not have
outlook installed, and they simply will not be able to use that nice
pdf->email feature in the report viewer.

So the two major uses of late binding is in the case where the application
may not be on the target machine, or 2nd there might be a different version
of the applicaton you are automation on the target machine than what you
developed with. If you use late binding then your code will not break if the
target computer has a different version of an application, or furthermore
does not have the application at all.
 
D

David W. Fenton

Ahh, ok. Good to know there is someone credible who has done
that.

Have you bothered to look at what functionality it provides? Just
creating a new A2K3 MDB and checking the references, the OLE library
has these classes:

IFontDisp
IFontEventsDisp
IPictureDisp
StdFont
StdFunctions.LoadPicture
StdFunctions.SavePicture
StdPicture

These do not appear to be things that I have any need for.

Ever.

And I doubt too many other people do, either.

What a waste.
 
D

David W. Fenton

So the general rule of thumb the suggestion is to create an blank
database, and look at the minimal references you need to run.

In A2K3, the default references are:

VBA
Access 11
OLE
DAO
ADO

I always kill OLE and ADO, since I don't use ADO (ever) and the OLE
library has no functionality that is of any use to anyone at all.
 
T

Tony Toews [MVP]

David W. Fenton said:
Have you bothered to look at what functionality it provides?
No.

Just
creating a new A2K3 MDB and checking the references, the OLE library
has these classes:

IFontDisp
IFontEventsDisp
IPictureDisp
StdFont
StdFunctions.LoadPicture
StdFunctions.SavePicture
StdPicture

These do not appear to be things that I have any need for.

Ever.

And I doubt too many other people do, either.

What a waste.

If that's all it does then agreed.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
S

Stanley L.

It sounds nice but it is a statement that is no true. For example, AC2K7 RT
is allowed to be redistributed without owning the developer license.
 
D

David W. Fenton

It sounds nice but it is a statement that is no true. For example,
AC2K7 RT is allowed to be redistributed without owning the
developer license.

Er, what? The runtime is BY DEFINITION a license to redistribute,
and it's free.

So, my statement is completely true, so far as I can tell.
 
T

Tony Toews [MVP]

Stanley L. said:
It sounds nice but it is a statement that is no true. For example, AC2K7 RT
is allowed to be redistributed without owning the developer license.

But the runtime is not an ActiveX control.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
S

Stanley L.

My apologies to David, Douglas and Tony because my reference to RT
distribution was a bad example that caused confusion. Bear with me ... I'm a
novice at this. I'm still groping for guidance for me to use. Let me be more
specific to clear things up. We are not talking about ActiveXs. I have an
ADODB reference in file MSADO21.TLB. I need this in my app to do datafile
linking especially since the Linked Table Manager in A2K7RT crashes the
running of RT. I do not have a developer license. Can I install this file on
a user's PC?

I don't want your answer to be swayed by the results but if the answer is
'NO' then my app cannot be run in RT.

What's the answer ... YES or NO?
Thanks, Stanley L
 
D

David W. Fenton

I have an
ADODB reference in file MSADO21.TLB. I need this in my app to do
datafile linking especially since the Linked Table Manager in
A2K7RT crashes the running of RT. I do not have a developer
license. Can I install this file on a user's PC?

It's a part of Access, i.e., if you install the runtime (which *is*
Access), it will be installed.

And by using the runtime, you *do* have a developer license to
distribute the runtime and all components that are part of the
runtime.
 
S

Stanley L.

I set up a Virtual PC (VPC) using XP 2005 as the OS. With no programs
installed in this VPC, I checked for the presence of all my original
references. Five of my original references were present: STDOLE2.TLB,
MSADO21.TLB, SCRRUN.DLL, MSADOX.DLL, and COMPATUI.DLL. There were 29 files
starting with OLE..... and 5 like MSADO??.TLB where ?? = 20, 21, 25, 26, and
27.

The conclusions I draw from this, and many of you also referred to these, are:
1. Even though Access may automatically check a reference as needed, it may
already be on the PC and not need to be checked if Access References looks
for it;
2.The previous suggestion of unchecking a reference and seeing if Access wil
compile, is a very worthwhile suggestion.
3. Two fellows previously discussed deleting an OLE reference without any
negative results. This very likely may have been because it already existed
with the OS installation.

Related to this, what locations does the reference routine search? \System?
and/or \System32? and/or where? Some of the references were deep into
'c:\Program Files\common files\system\ado'. Would references normally look
there if a reference was needed but was unchecked. Anyone know?

Another unknown is that the above is true for Windows 2005 plus any SP?
installed. One can never be sure a users PC is of the same version and hence
may not have these files.

Is the only safe installation, related to references, to have the install
program check for a reference and, if not found, install it if it can legally
be installed. WOW! Is this being overblown and unnecessarily complicated?

I respectfully must say that after 30 posts in this thread, I still do not
have a clear, definitive way of knowing whether a particular file can or
cannot be downloaded onto a user's PC. The one specific file I asked for a
YES or NO was answered with 'Probably not needed'.

I close with a proven saying that is all too often violated. "In a technical
enviornment, the ultimate degree of sophistication is SIMPLICITY."

I appreciate all your help notwithstanding my blunt comments above.
 
R

Rick Brandt

I set up a Virtual PC (VPC) using XP 2005 as the OS. With no programs
installed in this VPC, I checked for the presence of all my original
references. Five of my original references were present: STDOLE2.TLB,
MSADO21.TLB, SCRRUN.DLL, MSADOX.DLL, and COMPATUI.DLL. There were 29
files starting with OLE..... and 5 like MSADO??.TLB where ?? = 20, 21,
25, 26, and 27.

The conclusions I draw from this, and many of you also referred to
these, are: 1. Even though Access may automatically check a reference as
needed, it may already be on the PC and not need to be checked if Access
References looks for it;

I'm not sure you still understand what you are seeing in that references
dialog. The total list of unchecked references is coming from Windows.
Neither Access nor your particular file care one whit about unchecked
references.

The list of checked references is stored within each Access file. Some
are checked by default in new files and some get added later due to
developer actions. There are no default references that should ever be
missing because installing Access should install those libraries.

So all of the following are possible...

A checked reference that is not missing and is needed
A checked reference that is not missing and not needed
A checked reference that is missing and not needed (error)

An unchecked reference that is not missing and is needed (error)
An unchecked reference that is not missing and not needed
(this last is the vast majority of the list)
2.The previous suggestion of unchecking a reference and seeing if Access
wil compile, is a very worthwhile suggestion.

Yes, that generally is how you prove it is not needed. A "needed"
reference that is not checked will cause a compile error.
3. Two fellows previously
discussed deleting an OLE reference without any negative results. This
very likely may have been because it already existed with the OS
installation.

Irrelevant. LOTS of libraries exist on the OS installation. The reason
the reference can be removed is because the VBA project is not making any
calls to it (with early binding).
Related to this, what locations does the reference routine search?
\System? and/or \System32? and/or where? Some of the references were
deep into 'c:\Program Files\common files\system\ado'. Would references
normally look there if a reference was needed but was unchecked. Anyone
know?

This is provided by Windows. When you open a file by double-clicking
what chose the program to use? Windows. That list is the list of all
registered COM libraries being reported by Windows. It does not matter
where they are located as long as Windows knows where they are located.
That is what "registering" a library does. It tells Windows "here is
this library and where it is located. Please use this library any time
Some_COM_Object is instantiated in a program".
Another unknown is that the above is true for Windows 2005 plus any SP?
installed. One can never be sure a users PC is of the same version and
hence may not have these files.

That is precisely why it is not recommended that developers use them for
distributed applications. You can only be certain that the Access default
libraries will be present. Anything else is a crap shoot unless your
installation program is installing them.
Is the only safe installation, related to references, to have the
install program check for a reference and, if not found, install it if
it can legally be installed. WOW! Is this being overblown and
unnecessarily complicated?

It's very simple really. Don't use non-default references unless you are
in a controlled environment (company where all PC software is consistent)
or where your program is installing them.

Your install program does not have to "check for a reference".
Installation programs are automatically smart enough to only install a
library that does not already exist on the target PC. Of course it might
replace an existing library with yours if yours is newer. This could
potentially cause existing software on the PC to start malfunctioning.
Yet another reason to avoid non-default libraries.
I respectfully must say that after 30 posts in this thread, I still do
not have a clear, definitive way of knowing whether a particular file
can or cannot be downloaded onto a user's PC. The one specific file I
asked for a YES or NO was answered with 'Probably not needed'.

This is answered by how you acquired it. If you downloaded it or
purchased it then you should have been explicitly informed as to whether
you are allowed to distribute it. The fact that it is installed on your
PC certainly does not mean that any more than you are allowed to give
your copy of Word to 50 of your friends and co-workers.
I close with a proven saying that is all too often violated. "In a
technical enviornment, the ultimate degree of sophistication is
SIMPLICITY."

And the simplest way to deal with non-default COM libraries is to not use
them. The next simplest is to use them with late binding so that you do
not create a reference dependency. The least simple way is to add them
as references and use them with early binding.
 
D

David W. Fenton

3. Two fellows previously discussed deleting an OLE reference
without any negative results. This very likely may have been
because it already existed with the OS installation.

Er, what? No, deleting the reference has no effect if none of the
functionality provided by that library is used in your app. If it
*is* used, then your project won't compile after deleting the
reference.

There is virtually nothing of value in the OLE library, so far as I
can see, and I don't understand why MS decided to have it checked by
default. I *always* remove the reference because I'm never under any
circumstances going to use anything from that library.
 
T

Tony Toews [MVP]

Stanley L. said:
I have an
ADODB reference in file MSADO21.TLB.

I don't know enough about ADO to answer your question.
I need this in my app to do datafile
linking especially since the Linked Table Manager in A2K7RT crashes the
running of RT.

I doubt that the Linked Table Manager requires ADO. And with the
runtime you shouldn't be depending on the Linked Table Manager because
it doesn't exist on the client PC.

Relink Access tables from code
http://www.mvps.org/access/tables/tbl0009.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
T

Tony Toews [MVP]

Stanley L. said:
I set up a Virtual PC (VPC) using XP 2005 as the OS. With no programs
installed in this VPC, I checked for the presence of all my original
references. Five of my original references were present: STDOLE2.TLB,
MSADO21.TLB, SCRRUN.DLL, MSADOX.DLL, and COMPATUI.DLL. There were 29 files
starting with OLE..... and 5 like MSADO??.TLB where ?? = 20, 21, 25, 26, and
27.

SCRRUN and CAMPATUI? I doubt you need those.

Run the following code and tell us what references your app is
currently using. We'll tell you which ones to remove one at time to
ensure it won't cause a problem in your app. Then we'll get your app
down the minimum possible number of references.

Sub ViewReferenceDetails()

Dim ref As Reference

For Each ref In Access.References
Debug.Print ref.Name & " - " & ref.Major & "." & ref.Minor & "
- " & ref.FullPath
Next ref

End Sub

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top