Open another database .accdr

JPaulo

Developer
Local time
Today, 16:09
Joined
Dec 21, 2009
Messages
185
Hi all;

vba code, accdb how to open another database .accdr with password ?
 
This cod does not work to open .accdr

Sub OpenDB()
Dim MinhaPassword As Variant
MinhaPassword = "xpto"
strDbName = "c:\SeuBanco.accdr"
Set objaccess = New Access.Application
Set db = objaccess.DBEngine.OpenDatabase(strDbName, False, False, ";PWD=" & MinhaPassword)
objaccess.OpenCurrentDatabase filepath:=strDbName
End Sub
 
Can anyone help?
 
This cod does not work to open .accdr

Sub OpenDB()
Dim MinhaPassword As Variant
MinhaPassword = "xpto"
strDbName = "c:\SeuBanco.accdr"
Set objaccess = New Access.Application
Set db = objaccess.DBEngine.OpenDatabase(strDbName, False, False, ";PWD=" & MinhaPassword)
objaccess.OpenCurrentDatabase filepath:=strDbName
End Sub

I've not recently done this but here's a suggestion. There's one line that looks like vb.net code or visual basic code. Replace your code with this:

Code:
Sub OpenDB()
Dim MinhaPassword As String, strDbName as string
Dim objAccess as Access.Application

MinhaPassword = "xpto"
strDbName = "c:\SeuBanco.accdr"
Set db = objAccess.DBEngine.OpenDatabase(strDbName, False, False, ";PWD=" & MinhaPassword)
objAccess.OpenCurrentDatabase filepath:=strDbName
End Sub

See if this works, don't quote me on this.
 
Thanks for responding, but still does not work.
Note that want to open mode runtime (accdr).
 
So it does not work.

Function OpenACCRD()
With New Access.Application
.OpenCurrentDatabase "c:\teste.accdr", , "MyPassword"
.UserControl = True
.RunCommand acCmdAppMaximize
End With
Application.Quit
End Function

Help me please.
 
So it does not work.

Function OpenACCRD()
With New Access.Application
.OpenCurrentDatabase "c:\teste.accdr", , "MyPassword"
.UserControl = True
.RunCommand acCmdAppMaximize
End With
Application.Quit
End Function

Help me please.

I didn't even pick up on the accdr file format. Have a look at these links in order of relevance:

http://support.microsoft.com/kb/235422
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Access_Coding-Macros/Q_22871426.html
http://support.microsoft.com/kb/105128
 

Users who are viewing this thread

Back
Top Bottom