Re: Access Runtime on PC without MS Office



You don't need a reference to Excel in order to get Left to work in a query.
The Left function actually comes from the VBA library, which is usually the
first reference in the list. Unfortunately, if any of the other references
are broken, it affects functions from the VBA library, because that's
actually one of the last places Access looks for functions (this allows you
to override the built-in function with your own function with the same name
should you so desire)

Tony Toews has an introduction to Late Binding at
http://www.granite.ab.ca/access/latebinding.htm

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Rick in NS" <rbutler@xxxxxxxxxxxxxxxx(donotspam)> wrote in message
news:7359D3D4-A0A5-4E20-A880-436F5CE68A30@xxxxxxxxxxxxxxxx

--
Rick in NS
I have no idea if I have grasped the methodology at all with regard to
'late
binding' after having read everything I could find on the subject in the
MVP
site. Here is my feeble attempt to address the issue:

Dim objXL As Excel.Application
Set objXL = New Excel.Application

Sub My Sub()
Select Left(ClientName,1,7) As MySort
End Sub

objXL.Quit

Will this code address the Left function needed in the query?



"Rick Brandt" wrote:

Rick in NS wrote:
Oh boy!!! I have peppered the application with code to control
toolbars using the CommandBar object which I believe is in the
Microsoft Office Object Library 11.0 which is one of the references
in my application but not in the Access 2003 default. In addition I
have an Excel pivot table which relies on the Office XP Web Componets
(OWC10.DLL) to function properly. Removing either the reference to
the WDC10.DLL or to the Office Libary 11.0 kicks out numerous compile
errors.

I don't pretend to understand the concept of 'late binding'. Is
there a fix for this; or am I going to have to rewrite the
application removing any reference in the code to the CommandBar
object or to a OWc10.PivotTable?

Would another approach; insisting the target machine have some
version of Office on it resolve the issue?

No because "some version" would not be adequate. With early binding
(where you
set references) the exact version is required in almost all cases even
down to
having the same service packs installed.

Google these groups on "late binding". It is not very difficult to
switch your
code to use that and it really is the only way to do it when you have
multiple
machines that you cannot absolutely control what software is installed.
In
fact, most developers use early binding first to get things working
because
debugging is easier and you get to use the intellisense features in the
VBA
editor, then make the few changes to late binding afterwards when
everything is
working.

There are two huge advantages to late binding. If the user is totally
missing a
required external library, then the features in your app that depend on
that
library obviously don't work, but everything else in your app still
functions
normally. As you have seen, with early binding a missing reference
causes many
VBA functions to fail that have nothing at all to do with the missing
library.
Your app basically falls on its face.

The second big advantage is that your external library calls become (for
the
most part) version independant. In your case as long as you are not
using any
Excel features that only exist in a certain version then ANY version of
Office/Excel will likely work. With early binding you normally have to
have
the exact version for the app to function.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com





.



Relevant Pages

  • Re: Object Library References Question
    ... I revised my code and late binding worked as you suggested. ... but it does work with the reference to excel ... The last line shows the command to use the excel worksheet ... Dim xlApp As Excel.Application ...
    (microsoft.public.excel.programming)
  • Re: Outlook dependency
    ... >like to ship with my installation the libraries, files, OLB's and other ... Late binding means you can safely remove the reference and only have ... an error when the app executes lines of code in question. ...
    (microsoft.public.access.forms)
  • Re: Late Binding Problem between Excel and Project
    ... Jim Thomlinson wrote: ... I have an Excel file that imports data from a Project file. ... With early binding this created a problem for those who used the ... but if there reference doesn't exist then the ...
    (microsoft.public.excel.programming)
  • RE: Maintaining Maximum Platform Compatibility
    ... There are two aspects to compatibility. ... the current version of Excel may not work on older versions. ... This gets into early or late binding. ... Tools -> References and binding a reference to your project at design time. ...
    (microsoft.public.excel.programming)
  • Re: Excel Application Process Does Not Die (my problem solved)
    ... where there is no automatic decrement of a reference count upon ... reference COM components are set to null, then call a the static Collect ... > I have noticed a bunch of posts regarding the use of the Excel COM object> regarding the Excel process never dies. ... > My app is a console app that loops a list of clients and creates and saves> some excel docs. ...
    (microsoft.public.dotnet.languages.csharp)

Loading