Click to See Complete Forum and Search --> : access/ reports


maggie gallotti
April 12th, 2001, 02:01 PM
I have a simple file server application that uses Ms Access and Vb. I have a general password on the database. My reports are in Access. Each time I want to view a report, I set up an application object for Access, then I use the OpenCurrentDatabase method to make the connection, then use the docmd to actually view it. The problem is that I am prompted for a password each time I want to see a report, even though I already was prompted for one when I opened my application. Here's my code:
Set msaccess = New Access.Application
msaccess.OpenCurrentDatabase (" path of database")

msaccess.DoCmd.OpenReport "report name", acViewPreview
DoCmd.Maximize
msaccess.Visible = True

I tried putting the password in the OpenCurrentDatabase statement,but it won't take it. There must be a way to do this because I am looking at the data report designer, and it's really goofy.

Iouri
April 12th, 2001, 02:32 PM
Try to open your db as password protected

For Standard Security:

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\somepath\mydb.mdb;" & _
"Uid=Admin;" & _
"Pwd=;"

If you are using a Workgroup (System database):

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=\somepath\mydb.mdb;" & _
"SystemDB=\somepath\mydb.mdw;", _
"admin", ""


sConn = "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=" & DBPATH
sConn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPATH
sConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & DBPATH & ";uid=;pwd=;"

'latest and greatest
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DBNAME & _
";Persist Security Info=False"
Persist Security Info is important when db is password protected (False eliminate pwd protection?)

'===================================================================
'connection to secure database
Dim Cnn As ADODB.Connection
Dim Rst As ADODB.Recordset

'In the place where you want to establish your connection, such
'as the Initialize event of a class module, enter the following:

Dim strConnect As String
Set Cnn = New ADODB.Connection

'Substitute your own User IDs, Password, Data Source, and System
'database in the connection string below
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Password=MyPassword;User ID=Administrator;" & _
"Data Source=C:\AccessDBs\DB1.mdb;" & _
"Persist Security Info=True;" & _
"Jet OLEDB:System database=C:\AccessDBs\system.mdw"

With Cnn
.CursorLocation = adUseClient
.Open strConnect
End With

Set Rst = New ADODB.Recordset
Rst.ActiveConnection = Cnn

Iouri Boutchkine
iouri@hotsheet.com

maggie gallotti
April 12th, 2001, 04:24 PM
hi Iouri,
thanks for the information. The problem is that I am using DAO. I tried to use the "persist security" option , but I can't get it to work.