Solved

Access DB created with vba code/reference update?

Posted on 2004-08-03
8
549 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

867 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

24 Experts available now in Live!

Get 1:1 Help Now