UnsolvedCoding
Technical User
Hey all -
I solved all my problems for running Access from Excel except for one. It won't release the database after running the macro unless I close Excel and re-open it.
Anyone know how to actually close Access so it releases instead of needing to shut down Excel?
Heres the code
Sub Open_MDB()
Dim obj1 As AccessObject
Dim appAccess1
Dim strPath As String
Dim strFile As String
Dim strDBName As String
'Create a reference to another database file
Set appAccess1 = New Access.Application
strPath = "C:\Desktop\MDB.Folder\"
strFile = "Data_Import.mdb"
strDBName = strPath & strFile
appAccess1.OpenCurrentDatabase strDBName
' Run the macro
CheckAndCorrectColumns
' Close objects
appAccess1.CloseCurrentDatabase
appAccess1.Quit
Set appAccess1 = Nothing
End Sub
I solved all my problems for running Access from Excel except for one. It won't release the database after running the macro unless I close Excel and re-open it.
Anyone know how to actually close Access so it releases instead of needing to shut down Excel?
Heres the code
Sub Open_MDB()
Dim obj1 As AccessObject
Dim appAccess1
Dim strPath As String
Dim strFile As String
Dim strDBName As String
'Create a reference to another database file
Set appAccess1 = New Access.Application
strPath = "C:\Desktop\MDB.Folder\"
strFile = "Data_Import.mdb"
strDBName = strPath & strFile
appAccess1.OpenCurrentDatabase strDBName
' Run the macro
CheckAndCorrectColumns
' Close objects
appAccess1.CloseCurrentDatabase
appAccess1.Quit
Set appAccess1 = Nothing
End Sub