how do you change the current db

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have multiple access applications open. I would like to check what the current db is and if it is not the one I want, change it to a specific one. I know I can retrieve the current db with currentDb().Name, but am unaware how change it to the database I want to be current.
 
Hi,

What you would have to do is:

Dim Db As DAO.Database
IF CurrentDb.Name <> "some name expected" THEN
Set Db = OpenDatabase("full path name
to MDB")
ELSE
Set Db = CurrentDb()

END IF

Msgbox Db.Name ' or whatever code you are going
to use

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."



--------------------
| Thread-Topic: how do you change the current db
| thread-index: AcPp7xxa/vRYcSe0SN+7s2eEWPM4lA==
| X-Tomcat-NG: microsoft.public.access.queries
| From: "=?Utf-8?B?c2NvdA==?=" <[email protected]>
| Subject: how do you change the current db
| Date: Mon, 2 Feb 2004 16:46:07 -0800
| Lines: 1
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.access.queries
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.queries:188473
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.access.queries
|
| I have multiple access applications open. I would like to check what the
current db is and if it is not the one I want, change it to a specific one.
I know I can retrieve the current db with currentDb().Name, but am unaware
how change it to the database I want to be current.
|
 
That sounds unusual. If you will describe why you need multiple Access
applications open simultaneously, and why you need to "switch" between them,
the newgroup readers may be able to offer simpler designs.
 
Back
Top