Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Access03 Database from Access03 Database

Status
Not open for further replies.

zollo9999

Programmer
May 12, 2002
95
AU
Hi

My access database tests a version number in the backend against the number in the front end and if their is an update, I want to launch an access database installer and close the main database.

The code I have found in text books and on microsoft websites is not working.

An runtime error number 0 is always raised when trying to instantiate or open the database.

ie the GetObject method and the "New" instance of the class dont work. See these

Code:
Private Sub Form_Timer()
  On Error GoTo ErrorHandler
'Stop
  With Me
    .TimerInterval = 0
    !lblMessageToUser.Caption = "Checking for updates."
    !lblMessageToUser.Visible = True
    !cmdExit.SetFocus
    !cmdOpenRegister.Enabled = False
    !cmdAdmin.Enabled = False
    !cmdReports.Enabled = False
    .Repaint
  End With

'Test code here is removed
'If test indicates an update is avail, run this code...

Dim strInstaller As String
strInstaller = "S:\xxx\DbInstaller\Installer.mdb"

Dim objAccess As Access.Application
[b]
Set objAccess = GetObject(strInstaller)
[/b]
'or
[b]
Set objAccess = GetObject(strInstaller, "Access.Application")
[/b]
'or    
[b]
Set objAccess = New Access.Application
objAccess.OpenCurrentDatabase filepath:=strInstaller
[/b]
objAccess.Visible = True
    
Application.Quit acSaveYes

'Error handling code removed

Can anyone help?

Thanks
pb




Zollo A+ / VBA Developer
[thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top