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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a different database

Status
Not open for further replies.

cjany

IS-IT--Management
Nov 3, 2004
72
0
0
US
I would like an option button on an Access database form to close the current database and open another database. Any suggestions?

 
Well, this code doesn't seem to work on my PC, but at least it'll give you a starting point...

Code:
    Dim objAccess As Access.Application
    Dim strPath As String

    Set objAccess = CreateObject("Access.Application")
    strPath = "This is the file path to your other DB"

    objAccess.CloseCurrentDatabase
    objAccess.OpenCurrentDatabase strPath, False
 
Have a look to the OpenCurrentDatabase method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top