cwojtak
12-05-2019, 09:29 AM
Hello, I have a sub that opens a database that works every time. Now I tried to create a new sub, in the same workbook but a different module that opens a different database, using the same exact code and it doesn't work. No errors or anything, it just opens the db then closes it immediately.
Working code:
Sub OpenLinearityDB()
Dim appAccess As Object
'create new access object
Set appAccess = CreateObject("Access.Application")
'open the acces project
Call appAccess.OpenCurrentDatabase("C:\Users\username\Documents\Databases For Interlock\IBP_LINEARITY_WORKER.accdb")
appAccess.Visible = True
End Sub
Not Working Code:
Sub OpenDEPDatabase()
Dim appAccess As Object
'create new access object
Set appAccess = CreateObject("Access.Application")
'open the acces project
Call appAccess.OpenCurrentDatabase("C:\Users\username\Documents\Databases For Interlock\DEP_DEAL_WORKER.accdb")
appAccess.Visible = True
End Sub
Working code:
Sub OpenLinearityDB()
Dim appAccess As Object
'create new access object
Set appAccess = CreateObject("Access.Application")
'open the acces project
Call appAccess.OpenCurrentDatabase("C:\Users\username\Documents\Databases For Interlock\IBP_LINEARITY_WORKER.accdb")
appAccess.Visible = True
End Sub
Not Working Code:
Sub OpenDEPDatabase()
Dim appAccess As Object
'create new access object
Set appAccess = CreateObject("Access.Application")
'open the acces project
Call appAccess.OpenCurrentDatabase("C:\Users\username\Documents\Databases For Interlock\DEP_DEAL_WORKER.accdb")
appAccess.Visible = True
End Sub