Whilst looking how to do this I found this thread http://www.access-programmers.co.uk/forums/showthread.php?t=129779
It seems that the code that works is
dim accapp as access.application
set accapp = new access.application
accapp.opencurrentdatabase("c:\whatever\blah.mdb")
accapp.visible = true
I'm trying to load an accdb file so have replaced blah.mdb with blah.accdb. I don't believe this should cause any problems.
I have tried this and it works to a fashion.
It loads the database blah.accdb for a nano second!
If I step through the code blah.accdb becomes visible when "accapp.visible = true" is executed. However the following line is Exit Sub and once this is executed the database disappears.
If when "accapp.visible = true" is executed and before executing "End Sub" I switch to blah.accdb and click one of the options and then execute "End Sub" then blah.accdb remains open.
I am using access 2010 and one of the comments states "This works perfectly in Access 2010. Thanks!"
I'm obviously missing something. Does anyone know what?
It seems that the code that works is
dim accapp as access.application
set accapp = new access.application
accapp.opencurrentdatabase("c:\whatever\blah.mdb")
accapp.visible = true
I'm trying to load an accdb file so have replaced blah.mdb with blah.accdb. I don't believe this should cause any problems.
I have tried this and it works to a fashion.
It loads the database blah.accdb for a nano second!
If I step through the code blah.accdb becomes visible when "accapp.visible = true" is executed. However the following line is Exit Sub and once this is executed the database disappears.
If when "accapp.visible = true" is executed and before executing "End Sub" I switch to blah.accdb and click one of the options and then execute "End Sub" then blah.accdb remains open.
I am using access 2010 and one of the comments states "This works perfectly in Access 2010. Thanks!"
I'm obviously missing something. Does anyone know what?