Run Access sub from Excel

GeorgY

New member
Local time
Yesterday, 21:56
Joined
Mar 23, 2009
Messages
7
Can anyone tell me how I can run an Access sub from Excel VBA?

The sub is:
Code:
Sub CloseDB()
DoCmd.Quit
End Sub

Thanks in advance
 
this was googled, but it only works for one instance of access that is open, not for a specific database that is opened:
Code:
sub closeDB

dim app as object
set app = getobject(, "access.application")

app.quit

set app = nothing

end sub
 
Thanks, what exactly do I need to change in that code to make it work for me?
 
Just paste it into your Excel or Word macro and it will close Access down.
 
Just paste it into your Excel or Word macro and it will close Access down.

Ok, that works only if Access is physically open on my computer. I was hoping, that this would also log out any other users that may be logged into the database from another computer or application.

Any way to do this?

Thanks again..
 
what is the use of your access program if you don't use it.

I've created a program with VB that uses SQL to get and display data from the database onto a grid. Problem is that when the program is running, it is as if someone has opened Access and when the user tries to upload data from an Excel file to the database, the data simply does not get uploaded.

What I really want is for all the users to be logged out of the database, before the upload from Excel takes place.
 

Users who are viewing this thread

Back
Top Bottom