Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Another Database using VBA

Status
Not open for further replies.

GummowN

Programmer
Jul 26, 2002
157
GB
When a database is opened it launches another database which performs some timer based tasks which I would rather have running from another database.

Come the end of the day the user will close the main database, from here I want the database to also close the other database.

IE Look through open copies of access for the one that was launched automatically (by checking filename) and then close that one.

I am back programming for the first time in 3 months and so the brain is a bit rusty.
 
You need to get the class name of the application, then PostMessage a close command.
Check out for code.

hth

Ben

----------------------------------------------
Ben O'Hara "Where are all the stupid people from...
...And how'd they get so dumb?"
rockband.gif
NoFX-The Decline
----------------------------------------------
 
Thanks for the suggestion, but after a double espresso I changed the way I thought about it.

I now :
Dim acc as new access.application in the form,

On form open:
acc.OpenCurrentDatabase "C:\neil\SRTPartUpload.mdb"

On form close:
acc.CloseCurrentDatabase

HOWEVER - any idea how I can do the acc.opencurrentdatabase and include a username and password for a mdw?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top