Open a database from another database
is it possible to open a database protected with a password from another database? I want to build a code that opens a database,and supplies the necessary password,from another database.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
open db from another db (Access 2000)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » open db from another db (Access 2000)
- This topic has 12 replies, 5 voices, and was last updated 23 years ago.
AuthorTopicViewing 1 reply threadAuthorReplies-
WSMarkD
AskWoody LoungerMay 15, 2002 at 10:07 am #588166One option is to use DAO OpenDatabase method. Example:
Function TestOpenPwdDatabase() On Error GoTo Err_Handler Dim ws As DAO.Workspace Dim db As DAO.Database Dim tbl As DAO.TableDef Set ws = DBEngine.Workspaces(0) Set db = ws.OpenDatabase("C:LOGIN.mdb", False, False, "MS Access;PWD=123XYZ") For Each tbl In db.TableDefs Debug.Print tbl.Name Next tbl db.Close ws.Close Sub_Exit: Set ws = Nothing Set db = Nothing Set tbl = Nothing Exit Function Err_Handler: MsgBox "Error " & Err.Number & ": " & Err.Description Resume Sub_Exit End Function
You have to supply the optional Options and Read-Only arguments (can just use “False”) for OpenDatabase method or this won’t work, you’ll get error message “Not a valid password.” There’s no way I know of to provide password string if using TransferDatabase to import or link tables.
HTH -
WScharlotte
AskWoody LoungerMay 15, 2002 at 11:54 am #588181It depends on what you’re trying to do. Do you want to open an unprotected database and have it open a protected one so you can work in the protected one, or are you just trying to get data out of the protected one into the unprotected database?
Keep in mind that the purpose of the password is to keep unauthorized persons from opening a database. If you create a means of getting into it without the password, you have just invalidated the protection on the other database. I personally wouldn’t do that.
-
WSaral
AskWoody LoungerMay 15, 2002 at 1:45 pm #588192thank you for your reply.I am trying to get data out of the protected on into the unprotected database.I agrre with what you write about the protection it is just a special case where i need it and if you are interested i may send the explanation to you,however i am afraid i may be boring.How shall i proceed in my case to get data out of the protected database?
Kind regards
-
WScharlotte
AskWoody LoungerMay 16, 2002 at 3:32 am #588319You can create a workspace to open a session on the other database and pass the username and password in there:
Set wsp = DBEngine.CreateWorkspace(“”, strUser, strPwd, dbUseJet)
This assumes that the database in question is a Jet database, of course. I’ve used strUser and strPwd to represent variables containing the username and password you need to pass in.
The you open the remote database like this:
Set dbs = wsp.OpenDatabase(“F:Protected.mdb”,False)
You would substitute the correct path and filename for what I put in here.
After that, you can open recordsets on the protected database and use them to write data into recordsets opened on the CurrentDb.
-
WSaral
AskWoody Lounger -
WSRNCIENG
AskWoody LoungerMay 16, 2002 at 10:29 am #588356Charlotte,
I’ve tried to find a work around for this situation a few times w/o success, until now. However, I’m still a little lost…..
If the db I’m trying to EXPORT from is password protected, I would still need to know the password wouldn’t I? And If I did know the password, what’s the point in the code you offered? Or is your solution suggesting you wouldn’t need to know the user name and password? If the latter is correct, could you offer a little more explanation of the code you provided, as it seems to me that setting the variable would still require knowing the password in the first place.
As you know, I’m a still a little dense when it comes to code so please forgive me for asking what might seem to be silly questions.
Thanks in advance,
-
WScharlotte
AskWoody Lounger -
WSRNCIENG
AskWoody LoungerMay 17, 2002 at 10:34 am #588584Charlotte,
I realize what the original question was, I however, was asking a similar question in regards to the password, I’m sorry if i didn’t make myself clear. This post was the first post I’ve seen close enough to my situation so I stuck my nose in and only asked you because you had the solution to the password issue. PASSWORD PROTECTED DB was what caught my eye. If I’m out of line, then I apologize.
I was wanting to know if there was a way of EXPORTING objects from a password protected db w/o knowing the password. I know the code for exporting and importing, what I don’t know is how to do it when the password is unkown.
And as always, thanks for your help.
ps….the code you provided still seems to suggest the username and password must be known in the code. Just curious.
-
WScharlotte
AskWoody LoungerMay 17, 2002 at 12:27 pm #588615Roberta,
You aren’t out of line, but the code posted had nothing to do with an export, so your question confused me. Exports are done from within the database. That means you have to be able to open a database in order to Export, and that means you have to know the password in order to get there. There’s not much point in a password if anyone can come along and get around it.
-
WSRNCIENG
AskWoody Lounger -
WScharlotte
AskWoody Lounger -
WSpatt
AskWoody Lounger
-
-
-
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Best Courses to Study in Dubai with High Job Prospects (Awaiting moderation)
by
SonaliSharmaBR
1 hour, 48 minutes ago -
Small desktops
by
Susan Bradley
28 minutes ago -
Totally disable Bitlocker
by
CWBillow
6 hours, 9 minutes ago -
Totally disable Bitlocker
by
CWBillow
7 hours, 48 minutes ago -
Windows 11 ad from Campaign Manager in Windows 10 (Awaiting moderation)
by
Jim McKenna
11 hours, 18 minutes ago -
Phishers extract Millions from HMRC accounts..
by
Microfix
19 hours, 57 minutes ago -
Windows 10 22H2 Update today (5 June) says up-to-date but last was 2025-04
by
Alan_uk
21 hours, 49 minutes ago -
Thoughts on Malwarebytes Scam Guard for Mobile?
by
opti1
1 day ago -
Mystical Desktop
by
CWBillow
1 day, 1 hour ago -
Meta and Yandex secretly tracked billions of Android users
by
Alex5723
6 hours, 28 minutes ago -
MS-DEFCON 2: Do you need that update?
by
Susan Bradley
15 hours, 22 minutes ago -
CD/DVD drive is no longer recognized
by
WSCape Sand
1 day, 16 hours ago -
Windows 11 24H2 Default Apps stuck on Edge and Adobe Photoshop
by
MikeBravo
1 day, 19 hours ago -
North Face and Cartier customer data stolen in cyber attacks
by
Alex5723
1 day, 17 hours ago -
What is wrong with simple approach?
by
WSSpoke36
1 day, 9 hours ago -
Microsoft-Backed Builder.ai Set for Bankruptcy After Cash Seized
by
Alex5723
2 days, 4 hours ago -
Location, location, location
by
Susan Bradley
19 hours, 9 minutes ago -
Cannot get a task to run a restore point
by
CWBillow
2 days, 6 hours ago -
Frustrating search behavior with Outlook
by
MrJimPhelps
1 day, 20 hours ago -
June 2025 Office non-Security Updates
by
PKCano
2 days, 16 hours ago -
Secure Boot Update Fails after KB5058405 Installed
by
SteveIT
19 hours, 30 minutes ago -
Firefox Red Panda Fun Stuff
by
Lars220
2 days, 16 hours ago -
How start headers and page numbers on page 3?
by
Davidhs
3 days, 3 hours ago -
Attack on LexisNexis Risk Solutions exposes data on 300k +
by
Nibbled To Death By Ducks
2 days, 5 hours ago -
Windows 11 Insider Preview build 26200.5622 released to DEV
by
joep517
3 days, 11 hours ago -
Windows 11 Insider Preview build 26120.4230 (24H2) released to BETA
by
joep517
3 days, 11 hours ago -
MS Excel 2019 Now Prompts to Back Up With OneDrive
by
lmacri
3 days, 1 hour ago -
Firefox 139
by
Charlie
2 days, 18 hours ago -
Who knows what?
by
Will Fastie
1 day, 20 hours ago -
My top ten underappreciated features in Office
by
Peter Deegan
3 days, 12 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.