Solved

Binding - MS Access to MS Excel - What is it and does it matter

Posted on 2014-12-12
4
301 Views
Last Modified: 2014-12-13
I have read a few posts where people have indicated when within MS Access and creating an Excel instance that typically binding does not matter.  I am not quite sure what binding is relative to MS Access/Excel even after reading the posts.

However, one person indicated you should not do this:
Dim xlobj as Excel.Application
Dim objxlbook as workbook
Dim objxlsheet as worksheet
Set xlobj = CreateObject("Excel.Application)

You should do this
Dim xlobj as Object
Dim objxlbook as Object
Dim objxlsheet as Objects
Set xlobj = CreateObject("Excel.Application)

Whats the difference between the 2 sets of code ?
0
Comment
Question by:upobDaPlaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 150 total points
ID: 40497607
the first set is called early binding, which will require you to add the Excel library to your references

the second set is called Late binding that does not require the Excel library to the refernces

see this link Early and Late Binding (Visual Basic)
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 350 total points
ID: 40497609
There is early Binding and Late Binding.
With early binding, you go in the code editor to tools | references and set a reference to a library.
In this case, Microsoft Excel xx.0.
This provides you with Intellisense support and full F1 help support, which is very, very nice.
And if you are certain that your users have your version of Excel or higher, all will be well.
Early binding is very good in a personal, business and corporate environment where you have knowledge of the users' computer.

With Late binding, you do not set the reference.  You lose Intellisense and f1 support.  You must Dim all of the foreign items as Object and you may not use the application-specific constants -- you must discover and use their numeric equivalents instead.  So why would you do that?
Because you now no longer have a dependency on that specific library.  As long as the user has ANY version of Excel and you haven't used kitschy new features, your code will run.  This is very good if you are selling software to complete strangers.

Me, I use early binding and develop in Access 2003.  You, you need to decide what will work best for you.  Some folks will go through the development process using early binding, and then just before deployment, remove the references, fix the resulting compiling errors, and then ship the software.

Explanation enough?
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 40497718
Good explanation Nick
0
 

Author Closing Comment

by:upobDaPlaya
ID: 40498072
Great.  It makes sense for me to go with early binding.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question