Create link or reference with ADO dll during startup

Toine

New member
Local time
Today, 04:46
Joined
Sep 24, 2007
Messages
7
My database is used in a multiple user environment.
I want to upgrade now from the DAO structure to ADO so that I can work with transactions and 'rollback' them if necessary.
People work on different computers and I do not want to check a lot of computers if there is a reference to the ADO dll and if it is checked. I'm looking for a way to distribute the ADO data component automatically with the startup of the database and register it. Is this possible with vba?
 
I'm not sure that moving from DAO to ADO is necessarily an upgrade. It's my understanding that the Jet Database Engine is optimized for use with DAO. To enable a transaction in a DAO workspace the code is quite simple...
Code:
   DBEngine.Workspaces(0).BeginTrans
   CurrentDb.Execute "DELETE FROM SomeTable"
[COLOR="Green"]   'and then you can either...[/COLOR]
   DBEngine.Workspaces(0).CommitTrans
   DBEngine.Workspaces(0).Rollback
But as per your original question, I use code like this at startup to add a reference to a library.mde that provides a lot of commonly re-used functions...
Code:
   [COLOR="Green"]'Creates a reference to the Library database Lib.mde in the project folder[/COLOR]
   Dim rfs As Access.references
   Dim rf As Access.Reference
   Dim Filespec As String
   
   Set rfs = Application.references
   Filespec = CurrentProject.Path & "\lib.mde"
   If Me.fso.FileExists(Filespec) Then
      Set rf = rfs.AddFromFile(Filespec)
   Else
      Err.Raise 40001, , "The file 'Lib.mde' was not found...."
   End If
Adding a reference to ADO can't be much different.
Cheers,
 

Users who are viewing this thread

Back
Top Bottom