PDA

Click to See Complete Forum and Search --> : Access Report - Help needed urgently


rathi
Aug 7th, 2000, 09:32 PM
Hi everyone,

I have a password protected Access db, where I have reports.

I use this code, to preview the report.

Dim axs as New Access.Application
axs.OpencurrentDatabase("Path")
axs.Docmd.OpenReport "ReportName"
Set axs = Nothing

A small dialog box pops up, asking for the database password.

How can I provide the password in the code, so that the user need not enter it.

Please help.

Thank you.

JHausmann
Aug 8th, 2000, 12:00 AM
Originally posted by rathi
Hi everyone,

I have a password protected Access db, where I have reports.

I use this code, to preview the report.

Dim axs as New Access.Application
axs.OpencurrentDatabase("Path")
axs.Docmd.OpenReport "ReportName"
Set axs = Nothing

A small dialog box pops up, asking for the database password.

How can I provide the password in the code, so that the user need not enter it.

Please help.

Thank you.

Not sure if this will work but you can add the following parm to the command line when you run Access; /pwd password. So you might give:

axs.OpencurrentDatabase("Path" & " /pwd password")

a try.

JHausmann
Aug 9th, 2000, 11:33 AM
So, did it work?

rathi
Aug 9th, 2000, 09:43 PM
Originally posted by JHausmann
So, did it work?

Hausmann,

Sorry, it didn't work. But I got a wonderful idea from a friend to solve this.

using SendKeys, I have to send the password, before opening the Report.

This works.

Thanks for your support

Thom
May 12th, 2001, 11:49 AM
Hey Rathi! Could you please, PLEASE post the code that you got for this?? This is EXACTLY what my problem is right now! I'm trying to do the same thing you did! I'd really appreciate it!!

thomas

Clunietp
May 13th, 2001, 11:24 AM
http://support.microsoft.com/support/kb/articles/q235/4/22.asp

Thom
May 13th, 2001, 10:06 PM
Sorry Tom! I'm using ADO, not DAO!! That's why I need Rathi's solution! But thanks anyway...er...unless YOU know a way to do this using ADO?? <sg>

Clunietp
May 14th, 2001, 10:16 PM
Well ain't this special?


from Microsoft:
http://support.microsoft.com/support/kb/articles/q210/1/11.asp

Although in DAO, you can use the OpenDatabase method to open such a database without getting a password prompt, there is no method to do so in Access prior to Access 2002. The Application.OpenCurrentDatabase method of Access2002 includes and optional parameter to specify the database password.


Sorry Thom! Looks like you get to include the big, bulky DAO distribution with your app :D