473,769 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

late binding ?

I was reading about late binding, but I'm not completely sure what is to be
done in order to adjust code to late binding...
For example, I'm not sure if this is correct:

early binding:

Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
late binding:
Dim ws as Object
Set ws =CreateObject(" DAO.Workspace")
Dim ws as Object
Set db =CreateObject(" DAO.Database")
Dim qdf as Object
Set qdf =CreateObject(" DAO.QueryDef")
Dim rs as Object
Set rs =CreateObject(" DAO.Recordset")

VBA help says that class argument inside Create object function has to be in
appname.objectt ype format. Does it means that "DAO" should be preceded by
"Access", so the previous code should be like this:

Dim ws as Object
Set ws =CreateObject(" Access.DAO.Work space")
Dim ws as Object
Set db =CreateObject(" Access.DAO.Data base")
Dim qdf as Object
Set qdf =CreateObject(" Access.DAO.Quer yDef")
Dim rs as Object
Set rs =CreateObject(" Access.DAO.Reco rdset")
?
What exactly I need to change in my code in order to support "late binding"
?
All examples given in VBA help and internet are concerning late binding in
case of calling other Office aplication from Access, but I couldn't find
examples of late binding inside Access itself...so I'm little bit confused.
Is there any Add-in or program, that can change early binding declarations
to late binding declarations through all modules automaticcally ?
Zlatko
Nov 13 '05 #1
9 10427
On Wed, 17 Aug 2005 11:32:08 +0200, "Zlatko Matić"
<zl***********@ sb.t-com.hr> wrote:

You are doing it right in the first code block, but if I ever see you
late bind you DAO, you'll get a spanking :-)
DAO has nothing to do with Access perse; it is a standalone object
model to work with a Jet database, that happens to be embraced by
Access.
Use a technique not because you just read about it, but because you
have a need. Typically late binding is used with somewhat obscure
objects that you can't be sure exist on the user's computer, and where
you have the option to "gracefully degrade" your app if the object was
not found. DAO is not such an object, nor could you likely gracefully
degrade your app if it was not found.

-Tom.

I was reading about late binding, but I'm not completely sure what is to be
done in order to adjust code to late binding...
For example, I'm not sure if this is correct:

early binding:

Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
late binding:
Dim ws as Object
Set ws =CreateObject(" DAO.Workspace")
Dim ws as Object
Set db =CreateObject(" DAO.Database")
Dim qdf as Object
Set qdf =CreateObject(" DAO.QueryDef")
Dim rs as Object
Set rs =CreateObject(" DAO.Recordset")

VBA help says that class argument inside Create object function has to be in
appname.object type format. Does it means that "DAO" should be preceded by
"Access", so the previous code should be like this:

Dim ws as Object
Set ws =CreateObject(" Access.DAO.Work space")
Dim ws as Object
Set db =CreateObject(" Access.DAO.Data base")
Dim qdf as Object
Set qdf =CreateObject(" Access.DAO.Quer yDef")
Dim rs as Object
Set rs =CreateObject(" Access.DAO.Reco rdset")
?
What exactly I need to change in my code in order to support "late binding"
?
All examples given in VBA help and internet are concerning late binding in
case of calling other Office aplication from Access, but I couldn't find
examples of late binding inside Access itself...so I'm little bit confused.
Is there any Add-in or program, that can change early binding declarations
to late binding declarations through all modules automaticcally ?
Zlatko


Nov 13 '05 #2
Hi, Tom!
In fact the only reason why I was looking about late binding is because I
want to distribute .mde to users with different Office versions. I didn't
experience problems with DAO references, but ADO (msado15.dll), by the way.
So, my question could be asked also for ADO objects (connection object,
recordset object, command object...) as well as for DAO or any other
libraries.
I just couldn't find any true example of late binding in Access. Does
anybody use it in real life, after all? Or it is just hipothetical
possibility ?
If it is not common practice, how people solve problems concerning
compatibility on different Office versions ?
It is maybe not a big problem if you distribute .mdb, so every user can
adjust references, but it is not possible in .mde...
How do you solve references problem in .mde ?

Greetings,

Zlatko

"Tom van Stiphout" <no************ *@cox.net> je napisao u poruci interesnoj
grupi:gp******* *************** **********@4ax. com...
On Wed, 17 Aug 2005 11:32:08 +0200, "Zlatko Matić"
<zl***********@ sb.t-com.hr> wrote:

You are doing it right in the first code block, but if I ever see you
late bind you DAO, you'll get a spanking :-)
DAO has nothing to do with Access perse; it is a standalone object
model to work with a Jet database, that happens to be embraced by
Access.
Use a technique not because you just read about it, but because you
have a need. Typically late binding is used with somewhat obscure
objects that you can't be sure exist on the user's computer, and where
you have the option to "gracefully degrade" your app if the object was
not found. DAO is not such an object, nor could you likely gracefully
degrade your app if it was not found.

-Tom.

I was reading about late binding, but I'm not completely sure what is to
be
done in order to adjust code to late binding...
For example, I'm not sure if this is correct:

early binding:

Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
late binding:
Dim ws as Object
Set ws =CreateObject(" DAO.Workspace")
Dim ws as Object
Set db =CreateObject(" DAO.Database")
Dim qdf as Object
Set qdf =CreateObject(" DAO.QueryDef")
Dim rs as Object
Set rs =CreateObject(" DAO.Recordset")

VBA help says that class argument inside Create object function has to be
in
appname.objec ttype format. Does it means that "DAO" should be preceded by
"Access", so the previous code should be like this:

Dim ws as Object
Set ws =CreateObject(" Access.DAO.Work space")
Dim ws as Object
Set db =CreateObject(" Access.DAO.Data base")
Dim qdf as Object
Set qdf =CreateObject(" Access.DAO.Quer yDef")
Dim rs as Object
Set rs =CreateObject(" Access.DAO.Reco rdset")
?
What exactly I need to change in my code in order to support "late
binding"
?
All examples given in VBA help and internet are concerning late binding in
case of calling other Office aplication from Access, but I couldn't find
examples of late binding inside Access itself...so I'm little bit
confused.
Is there any Add-in or program, that can change early binding declarations
to late binding declarations through all modules automaticcally ?
Zlatko

Nov 13 '05 #3
Zlatko Matic wrote:
Hi, Tom!
In fact the only reason why I was looking about late binding is
because I want to distribute .mde to users with different Office
versions. I didn't experience problems with DAO references, but ADO
(msado15.dll), by the way. So, my question could be asked also for
ADO objects (connection object, recordset object, command object...)
as well as for DAO or any other libraries.
I just couldn't find any true example of late binding in Access. Does
anybody use it in real life, after all? Or it is just hipothetical
possibility ?
If it is not common practice, how people solve problems concerning
compatibility on different Office versions ?
It is maybe not a big problem if you distribute .mdb, so every user
can adjust references, but it is not possible in .mde...
How do you solve references problem in .mde ?


I would hazard a guess that for developers that know what there doing that
late binding is overwhelmingly used instead of early binding. I would NEVER
use early binding except in cases where there is absolute control over the
software that is installed (and isn't installed) on the target PCs. Late
binding is just too darned easy to implement to risk any chance of
versioning problems and broken references that early binding inevitably
produces.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #4
On Thu, 18 Aug 2005 21:22:44 +0200, "Zlatko Matic"
<zl***********@ sb.t-com.hr> wrote:

I use it quite regularly. For example in an app that uses Msft
MapPoint to draw a map. It's no big deal if you don't have MapPoint
installed; you'll just not have the "View as Map" button.

With regards to Office: let's assume that your app uses Word to
generate some letters, and that the user MUST have Office2000 or
better installed. Then write your code in Access 2000, with Word 2000
reference selected. You write early-binding code. If your app is
installed on a computer with a higher version of Office, the reference
will AUTOMATICALLY be "upgraded" to Word XP, Word 2003, etc. That's
the power of OLE for you.

-Tom.

Hi, Tom!
In fact the only reason why I was looking about late binding is because I
want to distribute .mde to users with different Office versions. I didn't
experience problems with DAO references, but ADO (msado15.dll), by the way.
So, my question could be asked also for ADO objects (connection object,
recordset object, command object...) as well as for DAO or any other
libraries.
I just couldn't find any true example of late binding in Access. Does
anybody use it in real life, after all? Or it is just hipothetical
possibility ?
If it is not common practice, how people solve problems concerning
compatibilit y on different Office versions ?
It is maybe not a big problem if you distribute .mdb, so every user can
adjust references, but it is not possible in .mde...
How do you solve references problem in .mde ?

Greetings,

Zlatko

"Tom van Stiphout" <no************ *@cox.net> je napisao u poruci interesnoj
grupi:gp****** *************** ***********@4ax .com...
On Wed, 17 Aug 2005 11:32:08 +0200, "Zlatko Matić"
<zl***********@ sb.t-com.hr> wrote:

You are doing it right in the first code block, but if I ever see you
late bind you DAO, you'll get a spanking :-)
DAO has nothing to do with Access perse; it is a standalone object
model to work with a Jet database, that happens to be embraced by
Access.
Use a technique not because you just read about it, but because you
have a need. Typically late binding is used with somewhat obscure
objects that you can't be sure exist on the user's computer, and where
you have the option to "gracefully degrade" your app if the object was
not found. DAO is not such an object, nor could you likely gracefully
degrade your app if it was not found.

-Tom.

I was reading about late binding, but I'm not completely sure what is to
be
done in order to adjust code to late binding...
For example, I'm not sure if this is correct:

early binding:

Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
late binding:
Dim ws as Object
Set ws =CreateObject(" DAO.Workspace")
Dim ws as Object
Set db =CreateObject(" DAO.Database")
Dim qdf as Object
Set qdf =CreateObject(" DAO.QueryDef")
Dim rs as Object
Set rs =CreateObject(" DAO.Recordset")

VBA help says that class argument inside Create object function has to be
in
appname.obje cttype format. Does it means that "DAO" should be preceded by
"Access", so the previous code should be like this:

Dim ws as Object
Set ws =CreateObject(" Access.DAO.Work space")
Dim ws as Object
Set db =CreateObject(" Access.DAO.Data base")
Dim qdf as Object
Set qdf =CreateObject(" Access.DAO.Quer yDef")
Dim rs as Object
Set rs =CreateObject(" Access.DAO.Reco rdset")
?
What exactly I need to change in my code in order to support "late
binding"
?
All examples given in VBA help and internet are concerning late binding in
case of calling other Office aplication from Access, but I couldn't find
examples of late binding inside Access itself...so I'm little bit
confused.
Is there any Add-in or program, that can change early binding declarations
to late binding declarations through all modules automaticcally ?
Zlatko


Nov 13 '05 #5
Hi, Rick.
So, could you tell me what is wrong with this part of code:

Dim ws As Object
Set ws = CreateObject("D AO.Workspace")
Dim db As Object
Set db = CreateObject("D AO.Database")
Dim qdf As Object
Set qdf = CreateObject("D AO.QueryDef")
Dim qdfSQL As String
Dim rs As Object
Set rs = CreateObject("D AO.Recordset")

On Error GoTo GRESKA

DoCmd.Hourglass True

Set ws = DBEngine(0)
Set db = CurrentDb
.....

When I execute this function, an error apears: "ActiveX component can't
create an object".
I suppose it is something regarding CurrentDb or DBEngine (0) ? How to open
current database using late binding ?
If you regulary use late binding yould you give me some example of DAO lata
binding ?
Thanks in advance,

Zlatko

"Rick Brandt" <ri*********@ho tmail.com> je napisao u poruci interesnoj
grupi:%T******* **********@news svr17.news.prod igy.com...
Zlatko Matic wrote:
Hi, Tom!
In fact the only reason why I was looking about late binding is
because I want to distribute .mde to users with different Office
versions. I didn't experience problems with DAO references, but ADO
(msado15.dll), by the way. So, my question could be asked also for
ADO objects (connection object, recordset object, command object...)
as well as for DAO or any other libraries.
I just couldn't find any true example of late binding in Access. Does
anybody use it in real life, after all? Or it is just hipothetical
possibility ?
If it is not common practice, how people solve problems concerning
compatibility on different Office versions ?
It is maybe not a big problem if you distribute .mdb, so every user
can adjust references, but it is not possible in .mde...
How do you solve references problem in .mde ?


I would hazard a guess that for developers that know what there doing that
late binding is overwhelmingly used instead of early binding. I would
NEVER
use early binding except in cases where there is absolute control over the
software that is installed (and isn't installed) on the target PCs. Late
binding is just too darned easy to implement to risk any chance of
versioning problems and broken references that early binding inevitably
produces.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com

Nov 13 '05 #6
"Zlatko Matić" <zl***********@ sb.t-com.hr> wrote in
news:de******** **@ss405.t-com.hr:
When I execute this function, an error apears: "ActiveX component
can't create an object".
I suppose it is something regarding CurrentDb or DBEngine (0) ?
How to open current database using late binding ?
If you regulary use late binding yould you give me some example of
DAO lata binding ?


Why in the world are you trying to do DAO with late binding? That's
a ridiculously crazy thing to do.

Keep in mind that CurrentDB is both a DAO function and a property of
the Access.Applicat ion object. This might give you the ability to do
lots of DAO even without a DAO reference, but I wouldn't know.
Removing the DAO reference seems to me like intentionally cutting
off your legs just before you try to run a marathon.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #7
OK., maybe it is crazy, but still I have my reasons...
Is it possible or not ? If yes, how to achieve late binding of DAO objects ?

"David W. Fenton" <dX********@bwa y.net.invalid> je napisao u poruci
interesnoj grupi:Xn******* *************** ************@21 6.196.97.142...
"Zlatko Matić" <zl***********@ sb.t-com.hr> wrote in
news:de******** **@ss405.t-com.hr:
When I execute this function, an error apears: "ActiveX component
can't create an object".
I suppose it is something regarding CurrentDb or DBEngine (0) ?
How to open current database using late binding ?
If you regulary use late binding yould you give me some example of
DAO lata binding ?


Why in the world are you trying to do DAO with late binding? That's
a ridiculously crazy thing to do.

Keep in mind that CurrentDB is both a DAO function and a property of
the Access.Applicat ion object. This might give you the ability to do
lots of DAO even without a DAO reference, but I wouldn't know.
Removing the DAO reference seems to me like intentionally cutting
off your legs just before you try to run a marathon.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

Nov 13 '05 #8
"Zlatko Matić" <zl***********@ sb.t-com.hr> wrote in
news:de******** **@ss405.t-com.hr:
OK., maybe it is crazy, but still I have my reasons...
Is it possible or not ? If yes, how to achieve late binding of DAO
objects ?


I don't know, and I really couldn't give a rat's ass if it *is*
possible, because it's just about the stupidist thing I've ever
heard of anyone attempting to do.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #9
Hello.
This weekend I succeded to achieve late binding of both DAO and ADO. After I
moved references away, everything worked just good and couldn't see any
significant performance decrease...
Greetings,

Zlatko

"David W. Fenton" <dX********@bwa y.net.invalid> je napisao u poruci
interesnoj grupi:Xn******* *************** ************@21 6.196.97.142...
"Zlatko Matić" <zl***********@ sb.t-com.hr> wrote in
news:de******** **@ss405.t-com.hr:
OK., maybe it is crazy, but still I have my reasons...
Is it possible or not ? If yes, how to achieve late binding of DAO
objects ?


I don't know, and I really couldn't give a rat's ass if it *is*
possible, because it's just about the stupidist thing I've ever
heard of anyone attempting to do.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3974
by: Mike MacSween | last post by:
Had some trouble with Word automation. Sorted it, in the process thought I would try late binding. Some people reccomend it. So this: ********************************************************* Public Sub MailMerge(strQuery As String, strTemplate As String) snip Dim doc As Word.Document Dim wrdApp As Word.Application snip Set wrdApp = New Word.Application
1
7938
by: JD Kronicz | last post by:
Hi .. I have an issue I have been beating my head against the wall on for some time. I am trying to use late binding for MS graph so that my end users don't have to worry about having the right version of the MS Graph type library. Up until now I have been walking them through the process of setting the references to include their version of MS Graph library. My problem is that I can not seem to get the syntax correct .. or perhaps...
14
4312
by: Composer | last post by:
I've read many postings about the problem of Access.References.IsBroken and the consensus seems to be that late binding is the cure-all. I have a very complex Access application that needs hundreds of lines of code to format a Word document in a very specific way. Because my clients have various versions of Word, the problem of broken references comes up. I wish Microsoft had implemented a reasonable solution, so that VBA could do...
5
2051
by: eBob.com | last post by:
In another thread VJ made me aware of Tag. Fantastic! I've been wanting this capability for a long time. But it seems that I cannot use it with Option Strict On. In an event handler I have ... Private Sub chkbxSelI_Click(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox("bingo for number " & sender.Tag.ToString) End Sub
30
2834
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as integer The integers in these arrays are actually pointers to different columns of data in a text file.
6
1894
by: Tim Roberts | last post by:
I've been doing COM a long time, but I've just come across a behavior with late binding that surprises me. VB and VBS are not my normal milieux, so I'm hoping someone can point me to a document that describes this. Here's the setup. We have a COM server, written in Python. For completeness, here is the script: ----- testserver.py ----- import pythoncom
2
8348
by: GS | last post by:
I have installed the ms PIA for ofc XP, and followed the article http://support.microsoft.com/kb/247412/ trying to paste into a worksheet However I got late binding not allowed errors .... webOCWraooer,Copy // get the desired data into clapboard
3
16072
ADezii
by: ADezii | last post by:
The process of verifying that an Object exists and that a specified Property or Method is valid is called Binding. There are two times when this verification process can take place: during compile time (Early Binding) or run time (Late Binding). When you declare an Object Variable as a specific Data Type, you are using Early Binding so the verification can take place during compile time. When you declare a Variable of the generic Object Data...
14
2041
by: Siv | last post by:
hi, I am converting an application that writes to an Excel spreadsheet and the code trips the "option Strict" that I would like on because the parser says "option Strict On disallows late binding", I am struggling to understand why I am tripping this error. This is the code that causes the problems: XLApp.Goto("MonthTitleTL") 'Goes to bookmark in sheet r = XLApp.ActiveCell.Row 'sets variable r equal
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.