[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to open another database through VBA code?

Posted on 2009-04-24
2
Medium Priority
?
1,615 Views
Last Modified: 2013-11-29
I want to have a button on my form open another database upon clicking.
0
Comment
Question by:pgerman
  • 2
2 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 24222875
number of ways

here is one

dim acc as Access.application

Set acc = New Access.Application
acc.OpenCurrentDatabase "C:\mydb.mdb"


see if this works also
followhyperlink "c:\mydb.mdb"


0
 
LVL 65

Accepted Solution

by:
rockiroads earned 1000 total points
ID: 24222880
I forgot to add, the first one using OpenCurrentDatabase is handy if you want to perform some work on that db. You must remember to close it though

acc.CloseCurrentDatabase
set acc=nothing


you do not need to bother with that if you use followhyperlink

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question