Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Password Protected Form and Report

0 views
Skip to first unread message

Aamer

unread,
Dec 23, 2009, 3:19:01 PM12/23/09
to
I have 2 questions

1. Is it possible to put a password on a perticular form?
2. Is it also possible to put a passoword on a perticular report?

If so, then please tell me how can i do that.
I have a database in which i want a perticular form and a perticular report
password protected, that no one can access but me.

P.s I dont want to put password on the whole database.

thank you

aamer

Jerry Whittle

unread,
Dec 23, 2009, 4:48:01 PM12/23/09
to
In a word: No. You might be able to cobble up something that acts like a
password on a from or report, but that wouldn't stop someone from opening it
manually. Also the data displayed in the form and report would still be in
the tables where someone could still see it.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Aamer

unread,
Dec 23, 2009, 5:06:01 PM12/23/09
to
I found one solution on this forum

Private Sub Command0_Click()
Dim strpassword As String
strpassword = InputBox("Password")
If strpassword = "Password" Then
DoCmd.OpenForm "Your Form"
Else: End If
DoCmd.Close acForm, "Your Form"
End Sub

But the problem is when i enter the password it shows the letters, infact it
should show ***** as I enter password.

yes i agree this is not a good solution but so far it will work, as long as
it does not show the charactors i type.

KenSheridan via AccessMonster.com

unread,
Dec 23, 2009, 6:54:03 PM12/23/09
to
Instead of using the InputBox function, which is cheap and cheerful but very
limited, create a dialogue form with a text box with an input mask property
of PASSWORD. Add a button to the form with code in its Click event procedure:


Const MESSAGETEXT = "Incorrect password."

If StrComp(Me.txtPassword, "Password", vbBinaryCompare) = 0 Then
DoCmd.OpenForm "'YourForm'"
DoCmd.Close acForm, Me.Name
Else
MsgBox MESSAGETEXT, vbExclamation, "Warning"
Me.txtPassword = Null
Me.txtPassword.SetFocus
End If

This will require a case-sensitive password to be entered. Open the dialogue
form in code whenever you want to open 'YourForm'. This is of course
extremely insecure as anyone can open YourForm directly or can open the
dialogue form's module and see the password.

Ken Sheridan
Stafford, England

Aamer wrote:
>I found one solution on this forum
>
>Private Sub Command0_Click()
>Dim strpassword As String
>strpassword = InputBox("Password")
>If strpassword = "Password" Then
>DoCmd.OpenForm "Your Form"
>Else: End If
>DoCmd.Close acForm, "Your Form"
>End Sub
>
>But the problem is when i enter the password it shows the letters, infact it
>should show ***** as I enter password.
>
>yes i agree this is not a good solution but so far it will work, as long as
>it does not show the charactors i type.
>

>> In a word: No. You might be able to cobble up something that acts like a
>> password on a from or report, but that wouldn't stop someone from opening it

>[quoted text clipped - 15 lines]
>> >
>> > aamer

--
Message posted via http://www.accessmonster.com

Aamer

unread,
Dec 23, 2009, 8:45:01 PM12/23/09
to
Can you please tell me how to apply this on a form, cause everything you said
went over my head.

I would appreciate if anyone could tell me how to this step by step.

"KenSheridan via AccessMonster.com" wrote:

> .
>

KenSheridan via AccessMonster.com

unread,
Dec 24, 2009, 6:06:22 AM12/24/09
to
1. Create a new unbound form.

2. Add a text box and name it txtPassword.

3. In the text box's properties sheet set its InputMask property to Password.
NB: it’s the word 'password' you enter here, not the text of the password
itself.

4. Add a button to the form an enter the text I posted in its Click even
procedure, changing the name of the form to that of your existing form which
you want to protect, and the password to the real password.

When you want to open the protected form open the new dialogue form instead,
and then enter the password and click the button to open the protected form.

You can provide a little more protection by amending the code in the button's
Click event procedure to:

Const MESSAGETEXT = "Incorrect password."

If StrComp(Me.txtPassword, "Password", vbBinaryCompare) = 0 Then

DoCmd.OpenForm "YourForm", OpenArgs:="Protected"


DoCmd.Close acForm, Me.Name
Else
MsgBox MESSAGETEXT, vbExclamation, "Warning"
Me.txtPassword = Null
Me.txtPassword.SetFocus
End If

Then in the protected form's Open event procedure put:

Cancel = Nz(Me.OpenArgs, "") <> "Protected"

This will prevent the form being opened directly from the database window.

Ken Sheridan
Stafford, England

Aamer wrote:
>Can you please tell me how to apply this on a form, cause everything you said
>went over my head.
>
>I would appreciate if anyone could tell me how to this step by step.
>

>> Instead of using the InputBox function, which is cheap and cheerful but very
>> limited, create a dialogue form with a text box with an input mask property

>[quoted text clipped - 41 lines]
>> >> >
>> >> > aamer

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access/200912/1

Douglas J. Steele

unread,
Dec 24, 2009, 11:23:04 AM12/24/09
to
Take a look at
http://www.databasejournal.com/features/msaccess/article.php/3848121/Extending-the-InputBox-function-for-MS-Access-Forms.htm

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Aamer" <Aa...@discussions.microsoft.com> wrote in message
news:AC668A26-C50B-4C8A...@microsoft.com...

Aamer

unread,
Dec 24, 2009, 11:21:01 PM12/24/09
to
Thank You Ken Sheridan it woked, you were a great help.

one last thing,
DoCmd.OpenForm "YourForm", OpenArgs:="Protected" do I have to type the
protected form name instead of protected or just protected?

"KenSheridan via AccessMonster.com" wrote:

> .
>

Aamer

unread,
Dec 24, 2009, 11:24:01 PM12/24/09
to
Douglas J. Steele

sample database on the link
"http://www.databasejournal.com/features/msaccess/article.php/3848121/Extending-the-InputBox-function-for-MS-Access-Forms.htm"
is missing. can you fix the link on your site as it would be great to see
sample aswell.

thank you

aamer

"Douglas J. Steele" wrote:

> .
>

Douglas J. Steele

unread,
Dec 25, 2009, 7:32:10 AM12/25/09
to
Sorry, not my site. I'll send a note to the editor, but I suspect it'll be a
few days before there's any response.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele

(no private e-mails, please)


"Aamer" <Aa...@discussions.microsoft.com> wrote in message

news:DC57A628-F571-4CC6...@microsoft.com...

Douglas J. Steele

unread,
Dec 28, 2009, 8:26:16 PM12/28/09
to
The site has been fixed.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_gmail.com> wrote in message
news:%23zd$I5VhKH...@TK2MSFTNGP04.phx.gbl...

0 new messages