[AccessD] Poll: Late vs. Early Binding

Chris Mackin chris at denverdb.com
Wed Apr 9 12:20:54 CDT 2003


Also it allows you to Dim the same variable twice, which without compiler
directives you can't do.  So when the app is compiled with Dev = 1, the only
part that exists as far as the application is concerned is:

Dim appXL as Excel.Application

The other part just doesn't exist when the application is compiled.

Chris Mackin
www.denverdb.com
Denver Database Consulting, LLC



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Mitsules, Mark
Sent: Wednesday, April 09, 2003 11:11 AM
To: 'accessd at databaseadvisors.com'
Subject: RE: [AccessD] Poll: Late vs. Early Binding


Thank you Chris, your method is more elegant than either of my methods.
1. Block comments.
2. "If 1=0 then..." blocks.



Mark

-----Original Message-----
From: Chris Mackin [mailto:chris at denverdb.com]
Sent: Wednesday, April 09, 2003 1:00 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Poll: Late vs. Early Binding


You can always use Compiler Directives and write code that is either early
or late binding.  For instance I almost always have a Compiler Constant
named Dev in all my applications.

Then in the code for early vs. late binding I have something like:

#IF Dev = 1 Then
	Dim appXL as Excel.Application
#Else
	Dim appXL as Object
#End IF

This is a simple example that demonstrates the power of the Compiler
Directive, depending on how the Dev constant is set, it will only compile
that part of the code, so you can set it up so that while Dev = 1 you use
Early binding with all of it's benefits, and when you get ready to deploy
setting Dev = 0 changes it to Late Binding

Chris Mackin
www.denverdb.com
Denver Database Consulting, LLC


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Charlotte Foust
Sent: Wednesday, April 09, 2003 10:30 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Poll: Late vs. Early Binding


Sometimes late binding is necessary to handle possible reference problems,
but it's always easier to write code using early binding, regardless of your
level of expertise.

Charlotte Foust

-----Original Message-----
From: Mitsules, Mark [mailto:mitsules_ms at nns.com]
Sent: Wednesday, April 09, 2003 8:16 AM
To: 'accessd at databaseadvisors.com'
Subject: RE: [AccessD] Poll: Late vs. Early Binding


Bryan,

Perhaps I could have said re-code rather than re-write, but your response
more closely answers the question I was NOT asking, which was... Do the
members of this group utilize the IDE advantages of early binding whenever
possible while coding or is the expertise at a level where the advantages
are negligible.

Thank you,

Mark


-----Original Message-----
From: Bryan Carbonnell [mailto:Bryan_Carbonnell at cbc.ca]
Sent: Wednesday, April 09, 2003 12:05 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Poll: Late vs. Early Binding


I don't know if it is common practice, but I usually write code using early
binding, If I am writing for a specific application version, then I leave it
as early bound. Otherwise I switch to late binding.

You shouldn't have to rewrite any code when switching. All you should have
to do is switch your DIMs to objects and derefernce the libraries.

You may also have to create your own constants for some of the built in
constants from the referenced libraries, but a wholesale rewrite shouldn't
be necessary.

Right or wrong, this is what works for me.

Bryan Carbonnell
bryan_carbonnell at cbc.ca

>>> mitsules_ms at nns.com 09-Apr-03 11:43:13 AM >>>
Is it a common practice to first code using early binding, then, after
debugging is complete, re-write using late binding?


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list