Thank you Si,
I have found one other area of our code (compact database, based on a response from robdog) where we originally took the early-bound approach and have now modified it to, what I think is, a late-bound method.
The following code shows my before (early) and after (late) code :
Code:
'Dim oApp As ACCESS.Application 'This was old code for early binding
'Set oApp = New ACCESS.Application 'This was old code for early binding
Dim oApp As Object 'Code for late binding (see next line)
Set oApp = CreateObject("Access.Application") 'Open Access by late binding
oApp.DBEngine.CompactDatabase "C:\RP\Temp1.mdb", "C:\RP\Temp2.mdb"
'The .mdb file now in C:\RP\Temp1.mdb is compacted and the result
'is placed into C:\RP\Temp2.mdb
Set oApp = Nothing
This method accords with the Si_the_Geek Excel tutorial about late binding for Excel. By Dim-ing an Object and then creating that object as an Access application, dependency upon a MS Access Y.0 Object Library is eliminated and I believe that the program will now run under any compatible version of Access (that used when written or later).
The code shown above works OK with NO project reference being called up to Microsoft Access Y.0 Object Library in the VB6 source code. I think that this now makes it late-bound.
camoore
Wales, UK