Open Access from VBA

JpSkyPilot

Registered User.
Local time
Today, 11:58
Joined
Feb 23, 2012
Messages
20
Hi:

I've built a database in Access (Vehicles FE). Then I built a second database (Vehicle Startup). The Vehicle Startup is openned as the startup database. It checks the "build" of the current copy of Vehicles FE on the current machine and then compares it to the "build" in the database on the server. if the build on the server is listed as newer than the one currently on the operator's computer, then it copies the newer version down to the current operator's computer.... When the start up program does it's thing (whether the build is new or not), then it needs to start the Vehicles FE that it has just copied down (or was there), and then close itself.

How do I get it to open the Vehicles FE and close itself? I have CloseCurrentDatabase...but need to be able to start the Vehicles FE application.

Hope this makes some sense!

Thanks in advance,

JP
 
You can use Shell or FollowHyperlink to open the new db, and

Application.Quit

to close the current one.
 
Thanks for the reply...I could not get back sooner...I was out of the office yesterday.

I have tried to use the "Shell" in this way:

Dim RetVa

RetVal = Shell("C:\Access 2010 Databases\Vehicles\Vehicles FE.accde", 1)

And I keep getting an Invalide Procedure or Argument Error...and the Vehicles FE.accde is in that location.

I've tried shell "C:\Access 2010 Databases\Vehicles\Vehicles FE.accde", 1
...and that does not work either.

Any suggestions?
 
Shell requires at least the name of the Access executable, then the path to your file. Typically I've seen the full path to the executable, then the path. Here's one from the VB6 app I wrote for version control:

"C:\PROGRA~1\MICROS~2\Office\MSACCESS.EXE C:\AccessAp\UserName\CabDispatchMap.MDE"
 
Get it working? Personally I find FollowHyperlink easier, as it uses the file types registered in Windows, so you just specify the file to be opened. I have run into times when it didn't work as expected, but normally it has.
 
The problem for me is that I'm still developing it to be run on computers without Access 2010 installed. I made an accde file to have the executable...now I have to also use Access 2010 to open it...and want to avoid that to see if it is working before I put it on other machines. I have not done the "package" yet for distribution...but, as I understand it, the Access runtime is included there and it will go on other machines...but I've never done this with Access...I have done a lot of programming with VB 6.0, but this is pretty new to me...so...I'm just doing "trial and error" to figure my way through it.

JP
 
Thank you, John.... I'll look the article over and see if I can use it...I really do appreciate your time...
 
Hi...if you're still there...I used the Application.followhyperlink...and it does open the program...but the program opens in a smaller window...I have the form set to docmd.maximize on Load...but the "container" that opens is only about 1/2 the size of the screen and almost centered...is there a way to adjust this with the followhyperlink call?

JP
 
Not that I'm aware of; that is one advantage of Shell.
 
Hi,

It sounds like the issue is almost resolved, but I thought I'd pass this on in case it helps.

I have been looking to do a similar thing recently, and stumbled across an application written by a fellow poster on this forum, Bob Larson, called FRONT-END AUTO-UPDATE ENABLING TOOL. This is designed to check the version of the user's front end, and compare with a master copy on a shared network drive. If the user's copy is out of date it closes Access, deletes the old version and copies the new version from the network before opening it.

http://www.btabdevelopment.com/ts/freetools

I have implemented this and it worked like a charm.
 
thanks a million, I will look this over and appreciate you sharing it with me.

JP
 

Users who are viewing this thread

Back
Top Bottom