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
-
Kevin Beaumont on Microsoft Recall
by
Susan Bradley
4 hours, 39 minutes ago -
The Surface Laptop Studio 2 is no longer being manufactured
by
Alex5723
5 hours, 46 minutes ago -
0Patch, where to begin
by
cassel23
5 hours, 31 minutes ago -
CFPB Quietly Kills Rule to Shield Americans From Data Brokers
by
Alex5723
19 hours, 24 minutes ago -
89 million Steam account details just got leaked,
by
Alex5723
7 hours, 9 minutes ago -
KB5058405: Linux – Windows dual boot SBAT bug, resolved with May 2025 update
by
Alex5723
1 day, 3 hours ago -
A Validation (were one needed) of Prudent Patching
by
Nibbled To Death By Ducks
18 hours, 55 minutes ago -
Master Patch Listing for May 13, 2025
by
Susan Bradley
6 hours, 3 minutes ago -
Installer program can’t read my registry
by
Peobody
1 hour ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
16 hours, 42 minutes ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
1 day ago -
False error message from eMClient
by
WSSebastian42
1 day, 15 hours ago -
Awoke to a rebooted Mac (crashed?)
by
rebop2020
2 days ago -
Office 2021 Perpetual for Mac
by
rebop2020
2 days, 1 hour ago -
AutoSave is for Microsoft, not for you
by
Will Fastie
21 hours, 58 minutes ago -
Difface : Reconstruction of 3D Human Facial Images from DNA Sequence
by
Alex5723
2 days, 4 hours ago -
Seven things we learned from WhatsApp vs. NSO Group spyware lawsuit
by
Alex5723
1 day, 5 hours ago -
Outdated Laptop
by
jdamkeene
2 days, 10 hours ago -
Updating Keepass2Android
by
CBFPD-Chief115
2 days, 15 hours ago -
Another big Microsoft layoff
by
Charlie
2 days, 15 hours ago -
PowerShell to detect NPU – Testers Needed
by
RetiredGeek
12 hours, 47 minutes ago -
May 2025 updates are out
by
Susan Bradley
3 hours, 42 minutes ago -
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
2 days, 21 hours ago -
Windows 11 Insider Preview build 26120.3964 (24H2) released to BETA
by
joep517
2 days, 21 hours ago -
Drivers suggested via Windows Update
by
Tex265
2 days, 21 hours ago -
Thunderbird release notes for 128 esr have disappeared
by
EricB
17 hours, 23 minutes ago -
CISA mutes own website, shifts routine cyber alerts to X, RSS, email
by
Nibbled To Death By Ducks
3 days, 4 hours ago -
Apple releases 18.5
by
Susan Bradley
2 days, 22 hours ago -
Fedora Linux 40 will go end of life for updates and support on 2025-05-13.
by
Alex5723
3 days, 5 hours ago -
How a new type of AI is helping police skirt facial recognition bans
by
Alex5723
3 days, 6 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.