GohDiamond
"Access- Imagineer that!"
- Local time
- Today, 13:09
- Joined
- Nov 1, 2006
- Messages
- 550
:banghead:I'm trying to connect to a 2nd MS Access database in order to get to the Forms collection
When I'm connecting to a 2nd database with no security, no password, I can use:
BUT HOW Do I get connected to a Secured Database that uses a /workgroup file that is not System.mdw
(btw: I know the name and where that secure mdw is)
I need to pass the valid Username and password to Logon AND be able to access the .AllForms collection.
If I use dbx as database and define a PrivDBEngine and Workspaces I can get logged on and into the 2nd database.
BUT I can't seem to get to the forms collection that way. dbx doesn't offer a path to Forms. TableDefs, sure. QueryDefs, sure. but no forms...
Is this possible? OR is there a better way to do this from outside the target database.
Thanks in advance!
Goh
When I'm connecting to a 2nd database with no security, no password, I can use:
Code:
strPath = "C:\Path\To\remote\Database.accdb"
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase (strPath)
For Each obj In appAccess.CurrentProject.AllForms
BUT HOW Do I get connected to a Secured Database that uses a /workgroup file that is not System.mdw
(btw: I know the name and where that secure mdw is)
I need to pass the valid Username and password to Logon AND be able to access the .AllForms collection.
If I use dbx as database and define a PrivDBEngine and Workspaces I can get logged on and into the 2nd database.
Code:
Dim dbe As DAO.DBEngine
Dim ws As DAO.Workspace
Dim dbx As DAO.Database
Dim SysDB As String, username as string, pswd As String
'https://arstechnica.com/civis/viewtopic.php?t=437292
Set dbe = New DAO.PrivDBEngine
' Add variable for Database string
SysDB = "c:\workgroup\securefile.mdw"
dbe.SystemDB = SysDB
' Enter WorkGroup Credentials
username = InputBox("Enter your PND User Name", "Credentials", "")
dbe.DefaultUser = username
pswd = InputBox("Enter your PND password", "Credentials", "")
dbe.DefaultPassword = pswd
Set ws = dbe.Workspaces(0)
Set dbx = ws.OpenDatabase(dbFullPath)
BUT I can't seem to get to the forms collection that way. dbx doesn't offer a path to Forms. TableDefs, sure. QueryDefs, sure. but no forms...
Is this possible? OR is there a better way to do this from outside the target database.
Thanks in advance!
Goh
Last edited: