A family of Microsoft relational database management systems designed for ease of use.
This page has some specifications:
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
From my VBA Code, I need to open a backend DB that has a form that runs on opening by virtue of Current Database option "Display Form" being set to open the form "closeform".
Form "closeform" shuts the BE down immediately to prevent people from accessing it other than via the FE, which has a bypass function. (It runs "DoCmd.Close acForm, "CloseForm", acSaveYes" and "DoCmd.quit acExit".)
I need to know how to open the BE with VBA (so I can check if I need to add a field). Right now I'm trying to use the code below, but I keep getting this error (Run-time error '3151':ODBC-connection to <database> failed).
I'm thinking the problem might be connected with the way "closeform" behaves. But even if the connection problem isn't due to this feature, I need a way to block "closeform" so I can work with the DB once it's open.
So two questions:
--how can I get the connection?
--how can I programmatically change the "Display Form" setting so I can work with the BE?
Thanks.
Option Compare Database
Option Explicit
Public Sub DBConnect()
Dim dbBE As dao.Database
Dim strDBName As String
strDBName = CurrentProject.Path & "\theBE.accdb"
Set dbBE = OpenDatabase(strDBName,false ,false ,"PASSWORD=nnnnnn")
'Debug.Print strDBName
End Sub
A family of Microsoft relational database management systems designed for ease of use.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
This page has some specifications:
I figured it out. Needed
dim ws as workspace
Set ws = DBEngine.Workspaces(0)
Set dbBe = ws.OpenDatabase(strDBName,false ,false ,";PWD=nnnnnn")
I don't see any explanation anywhere why its ";PWD" rather than "PASSWORD", which I think I see in some examples. And why the ';'?