Open MS Access db file from Excel with VBA - then can't open w/ Explorer

PaulZak

Board Regular
Joined
Aug 22, 2006
Messages
105
Hi all,

I have the following code that opens my MS Access pw-protected backend from a button on my custom ribbon in the Excel front-end. The problem is once I do this (I open the DB file from Excel, review DB, close the DB/Access window), if I try to open the db file ** from MS Explorer ** then all I see is an .ldb file appears but I never get a window opening with for the Access db file. (I do get prompted for the PW to open the db file, as usual.)

So the problem is: I can't open the DB file with Explorer until I close the Excel front-end that ran the following code. It's like code in Excel has locked on the file or something when it opened the DB. (The file is NOT opened exclusively - I can open it fine if I open MS Access then select the file.) The point is it can be confusing when trying to open the db file directly in Explorer and not getting any results (again, that is until I close the Excel file and then it opens from Explorer fine.)

If I never open the db file from the Excel button (following code) while I have the Excel front-end open, the Access db file opens fine from Explorer. But once I do open it from Excel, something in the following code prevents the Access file from opening directly.

So, am I missing some code that, once DB file is opened, will release the file so I can then open from Explorer? (This should be an easy one for folks to try themselves and test. But notice in my scenario the Db file is PW protected so please do the same if testing!)

Hoping for some good feedback...
=====================================

Sub OpenAccessDB()

Public appAccess as Access.Application

Set appAccess = CreateObject("Access.Application")

appAccess.OpenCurrentDatabase gMDBName, , gStdPassword

appAccess.visible = True

'NOTE: If this code is enabled, the Access window does NOT appear.
'Set appAccess = Nothing

Exit sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,215,358
Messages
6,124,487
Members
449,165
Latest member
ChipDude83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top