Access 2013
I have a database open and a form with a button to accomplish the following:
1. open another database instance
2. import Excel files into db2
3. close the other database instance
I'm using the following code:
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase DLookup("strImp", "qlkpImpSb"), False
'make it visible
appAccess.Visible = True
'do the import using appAccess.DoCmd.TransferSpreadsheet...
appAccess.CloseCurrentDatabase
Set appAccess = Nothing
Database 1 and Database 2 share some linked tables, and sometimes when the above code above executes I get the error "You already have the database open."
How do I test to see if the database is open, and if it is, use it?
I have a database open and a form with a button to accomplish the following:
1. open another database instance
2. import Excel files into db2
3. close the other database instance
I'm using the following code:
Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase DLookup("strImp", "qlkpImpSb"), False
'make it visible
appAccess.Visible = True
'do the import using appAccess.DoCmd.TransferSpreadsheet...
appAccess.CloseCurrentDatabase
Set appAccess = Nothing
Database 1 and Database 2 share some linked tables, and sometimes when the above code above executes I get the error "You already have the database open."
How do I test to see if the database is open, and if it is, use it?