Solved

Access DB created with vba code/reference update?

Posted on 2004-08-03
8
548 Views
Last Modified: 2010-10-20
Hi everyone I have made a Access DB and have several forms with vba code, I have made a MDE file but wanted to know because all the refereneces (word and excel) are linked to office 2003 applications will this database work with older office 2000 or xp applications? such as excel and word? and when the new microsoft applications will come out will these references still work - will they upgrade themselves? or would i have to go to the mdb file and do it myself?
0
Comment
Question by:eazy123
  • 4
8 Comments
 
LVL 34

Expert Comment

by:flavo
ID: 11701343
If you use early binding then no.

You'll need to use late binding. (its slower though)

You dont need refrences for this, so get rid of them

Example usage

Dim objExcel as object

Set objExcel = CreateObject("Excel.Application")

0
 
LVL 34

Accepted Solution

by:
flavo earned 125 total points
ID: 11701354
I had a similar Q today, heres one of my comments

Early v late binding:

Early binding
- Need to add a refrence (Tools - refrences)
- Faster
- Will fail if the exact refrence (dll) is not on the pc
- use like Dim xl as Excel.Application
             Set xl = New excel.application

Late Binding
- slower
- No refrences (tools - refences)
- Will work on for example Excel 97 if you develop on Excel 2000 (if same properties / methods were present)
- Use like - Dim xl as object
                set xl = createobjecy("excel.application")
0
 
LVL 34

Expert Comment

by:flavo
ID: 11701370
It is one of the problems from using early binding.  

I generally code everything up firstly with early binding so i get the IntelSense working, then once its all tested and debuged, change it to late binding just incase.

Dave
0
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.

 

Author Comment

by:eazy123
ID: 11701383
how do i change it to late binding?
0
 
LVL 34

Expert Comment

by:flavo
ID: 11701459
Take away the refreces to Excel and word (leave Access)

Then replace anything that says

Dim xl as Excel.Appication

with

Dim xl as Object

and replace anything with

Set xl = New Excel.Application

with

Set xl = CreateObject("Excel.Application")

Dave
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 125 total points
ID: 11703298
Actually, Access is USUALLY "intelligent" enough to update references ... for example, I use Excel 2000 on one dev computer, and most of my clients use 2002 ... if I make a reference to Excel 2000 on that laptop, build an .mde, and deploy it to their machine (with Excel 2002 installed), the .mde file will automatically re-reference to the  Excel 2002 library ...

However, you'll notice I said "usually" ... I'd not trust that in a distributed app, and would instead follow Dave's advice re" Late Binding (for more info, search on CreateObject in online help and Google) and check out Mitch Kaplan's site for the most comprehenisve look at this technique:

http://www.trigeminal.com/usenet/usenet026.asp

Terry Kreft's Ref Wizard:
http://www.mvps.org/access/modules/mdl0022.htm

The biggest concern in your environment is that you NOT use version-specific items (for example the Printer object in 2003, which is NOT available downstream) ... if you do this, your code WILL fail. Even if you develop in the 2003 environment with the default 2000 format, you can still use features of 2003 which may not be available downstream ...
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now