Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 6th, 2008, 08:12 AM
Authorized User
 
Join Date: Oct 2006
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to open different access database from code

I would like to know if there is a way to open a different access database from the existing one, and in doing so, close the existing one.

I will probably use a switchboard button or similar for the user.

Its probably simple but I can't find it....

Thanks


 
Old May 6th, 2008, 08:19 AM
Authorized User
 
Join Date: Oct 2006
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ha! I always find it as soon as I post....


Dim appAccess As Application

Sub OpenReportDatabase()
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "G:\Shipping\OrdersReporting.mdb"
End Sub


 
Old May 6th, 2008, 11:49 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You left out this line:

Application.Quit

to close the current database.


mmcdonal

Look it up at: http://wrox.books24x7.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Open access database with pwd saikrishnan Pro VB Databases 1 October 9th, 2005 10:45 PM
Access is unable to open database window amerk20 Access 1 April 21st, 2005 11:16 AM
Microsoft Access can't open the database because. vinodkalpaka Classic ASP Components 2 August 4th, 2004 06:27 PM
Microsoft Access can't open the database because. vinodkalpaka Classic ASP Databases 2 July 24th, 2004 04:37 PM
Access Database: Open or closed?? Sach Classic ASP Databases 1 October 17th, 2003 06:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.