Group:  Microsoft Access ยป microsoft.public.access.security
Thread: Command Button Password

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Command Button Password
Roger Bell 21.09.2006 01:38:02
Could anyone tell me if it is possible to write some code into the "Onclick"
Event procedure that requires a password before the user can access a command
Button or Ctrl Tab?
Thanks for any help
Re: Command Button Password
"tina" <nospam[ at ]address.com> 21.09.2006 02:34:38
here's an example of one way to do it, as

Private Sub Command0_Click()

If InputBox("enter the password") = "something" Then
<do whatever the command button is supposed to do here>
Else
MsgBox "sorry, Charlie"
End If

End Sub

hth


"Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
news:82883FC1-BEB7-40CE-AB06-3CF5B2B452E9[ at ]microsoft.com...
[Quoted Text]
> Could anyone tell me if it is possible to write some code into the
"Onclick"
> Event procedure that requires a password before the user can access a
command
> Button or Ctrl Tab?
> Thanks for any help


Re: Command Button Password
Roger Bell 21.09.2006 02:50:02
Thanks for that Tina. How can I add the code you supplied to the existing
procedure that currently reads as follows:

Private Sub ENTRE_WEEKLY_PLANNED_GIVING_Click()
On Error GoTo Err_ENTRE_WEEKLY_PLANNED_GIVING_Click

Dim stDocName As String

stDocName = "PLANNED GIVING WEEKLY"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click:
Exit Sub

Err_ENTRE_WEEKLY_PLANNED_GIVING_Click:
MsgBox Err.Description
Resume Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click

End Sub


"tina" wrote:

[Quoted Text]
> here's an example of one way to do it, as
>
> Private Sub Command0_Click()
>
> If InputBox("enter the password") = "something" Then
> <do whatever the command button is supposed to do here>
> Else
> MsgBox "sorry, Charlie"
> End If
>
> End Sub
>
> hth
>
>
> "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> news:82883FC1-BEB7-40CE-AB06-3CF5B2B452E9[ at ]microsoft.com...
> > Could anyone tell me if it is possible to write some code into the
> "Onclick"
> > Event procedure that requires a password before the user can access a
> command
> > Button or Ctrl Tab?
> > Thanks for any help
>
>
>
Re: Command Button Password
Ray Cacciatore 21.09.2006 20:07:02
Roger,

Although the code provided by tina may appear to work, nothing stops users
from running the query called "PLANNED GIVING WEEKLY" from the database
window. The code behind this button simply calls a query and opens it on the
screen for users to edit.

If you open the database window and click on the Queries tab, you'll find a
query called "PLANNED GIVING WEEKLY", if you double-click it, it will open
for you to edit. Nothing stops users from opening it from there. I'm assuming
you took care of this "back door".

Ray

"Roger Bell" wrote:

[Quoted Text]
> Thanks for that Tina. How can I add the code you supplied to the existing
> procedure that currently reads as follows:
>
> Private Sub ENTRE_WEEKLY_PLANNED_GIVING_Click()
> On Error GoTo Err_ENTRE_WEEKLY_PLANNED_GIVING_Click
>
> Dim stDocName As String
>
> stDocName = "PLANNED GIVING WEEKLY"
> DoCmd.OpenQuery stDocName, acNormal, acEdit
>
> Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> Exit Sub
>
> Err_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> MsgBox Err.Description
> Resume Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click
>
> End Sub
>
>
> "tina" wrote:
>
> > here's an example of one way to do it, as
> >
> > Private Sub Command0_Click()
> >
> > If InputBox("enter the password") = "something" Then
> > <do whatever the command button is supposed to do here>
> > Else
> > MsgBox "sorry, Charlie"
> > End If
> >
> > End Sub
> >
> > hth
> >
> >
> > "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> > news:82883FC1-BEB7-40CE-AB06-3CF5B2B452E9[ at ]microsoft.com...
> > > Could anyone tell me if it is possible to write some code into the
> > "Onclick"
> > > Event procedure that requires a password before the user can access a
> > command
> > > Button or Ctrl Tab?
> > > Thanks for any help
> >
> >
> >
Re: Command Button Password
Roger Bell 22.09.2006 01:12:01
Thanks for that Ray, understood, but can you tell me how I incorporate the
code Tina supplied into my existing "Onclick" event procedure as mentioned in
my previous reply. Also is it possible to have a similar procedure for
opening a specific page within a "Ctrl Tab"?

Thanks in advance

"Ray Cacciatore" wrote:

[Quoted Text]
> Roger,
>
> Although the code provided by tina may appear to work, nothing stops users
> from running the query called "PLANNED GIVING WEEKLY" from the database
> window. The code behind this button simply calls a query and opens it on the
> screen for users to edit.
>
> If you open the database window and click on the Queries tab, you'll find a
> query called "PLANNED GIVING WEEKLY", if you double-click it, it will open
> for you to edit. Nothing stops users from opening it from there. I'm assuming
> you took care of this "back door".
>
> Ray
>
> "Roger Bell" wrote:
>
> > Thanks for that Tina. How can I add the code you supplied to the existing
> > procedure that currently reads as follows:
> >
> > Private Sub ENTRE_WEEKLY_PLANNED_GIVING_Click()
> > On Error GoTo Err_ENTRE_WEEKLY_PLANNED_GIVING_Click
> >
> > Dim stDocName As String
> >
> > stDocName = "PLANNED GIVING WEEKLY"
> > DoCmd.OpenQuery stDocName, acNormal, acEdit
> >
> > Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > Exit Sub
> >
> > Err_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > MsgBox Err.Description
> > Resume Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click
> >
> > End Sub
> >
> >
> > "tina" wrote:
> >
> > > here's an example of one way to do it, as
> > >
> > > Private Sub Command0_Click()
> > >
> > > If InputBox("enter the password") = "something" Then
> > > <do whatever the command button is supposed to do here>
> > > Else
> > > MsgBox "sorry, Charlie"
> > > End If
> > >
> > > End Sub
> > >
> > > hth
> > >
> > >
> > > "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> > > news:82883FC1-BEB7-40CE-AB06-3CF5B2B452E9[ at ]microsoft.com...
> > > > Could anyone tell me if it is possible to write some code into the
> > > "Onclick"
> > > > Event procedure that requires a password before the user can access a
> > > command
> > > > Button or Ctrl Tab?
> > > > Thanks for any help
> > >
> > >
> > >
Re: Command Button Password
"tina" <nospam[ at ]address.com> 22.09.2006 02:23:03
[Quoted Text]
> How can I add the code you supplied to the existing
> procedure

Private Sub ENTRE_WEEKLY_PLANNED_GIVING_Click()
On Error GoTo Err_ENTRE_WEEKLY_PLANNED_GIVING_Click

Dim stDocName As String

stDocName = "PLANNED GIVING WEEKLY"

If InputBox("enter the password") = "something" Then
DoCmd.OpenQuery stDocName, acNormal, acEdit
Else
MsgBox "sorry, Charlie"
End If

Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click:
Exit Sub

Err_ENTRE_WEEKLY_PLANNED_GIVING_Click:
MsgBox Err.Description
Resume Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click

End Sub

hth


"Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
news:A3CF6A2F-A397-413D-8FB3-82DAC3695B2E[ at ]microsoft.com...
> Thanks for that Tina. How can I add the code you supplied to the existing
> procedure that currently reads as follows:
>
> Private Sub ENTRE_WEEKLY_PLANNED_GIVING_Click()
> On Error GoTo Err_ENTRE_WEEKLY_PLANNED_GIVING_Click
>
> Dim stDocName As String
>
> stDocName = "PLANNED GIVING WEEKLY"
> DoCmd.OpenQuery stDocName, acNormal, acEdit
>
> Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> Exit Sub
>
> Err_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> MsgBox Err.Description
> Resume Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click
>
> End Sub
>
>
> "tina" wrote:
>
> > here's an example of one way to do it, as
> >
> > Private Sub Command0_Click()
> >
> > If InputBox("enter the password") = "something" Then
> > <do whatever the command button is supposed to do here>
> > Else
> > MsgBox "sorry, Charlie"
> > End If
> >
> > End Sub
> >
> > hth
> >
> >
> > "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> > news:82883FC1-BEB7-40CE-AB06-3CF5B2B452E9[ at ]microsoft.com...
> > > Could anyone tell me if it is possible to write some code into the
> > "Onclick"
> > > Event procedure that requires a password before the user can access a
> > command
> > > Button or Ctrl Tab?
> > > Thanks for any help
> >
> >
> >


Re: Command Button Password
"tina" <nospam[ at ]address.com> 22.09.2006 02:39:05
[Quoted Text]
> is it possible to have a similar procedure for
> opening a specific page within a "Ctrl Tab"?

well, pages in a tab control don't "open" and "close", you merely navigate
from one to another. here's one way to stop the uninvited user from moving
to a "protected" tab, as

Private Sub TabCtl0_Change()

If Me!TabCtl0 = 1 Then
If Not InputBox("enter password") = "something" Then
Me!TabCtl0 = 0
MsgBox "sorry, Charlie"
End If
End If

End Sub

in the above example, the name of the tab control is TabCtl. each page in a
tab control has an index value - the first page's index value is 0, the
second page's value is 1, etc. the "value" of the tab control is the index
value of the currently selected tab page. so the above code says: if the
user clicks on the second tab page (which has an index value of 1), an input
box will open for the password to be entered; if the password is not
correct, the first tab page is selected instead; if the password IS correct,
the second tab page is selected as the user intended.

personally, i prefer to not show things to users that they can't actually
get at - it just causes frustration. i'd be more likely to hide the
"password-protected" page, and make it visible only when the correct
password is provided. to do that, you can use a command button, something
along the lines of

Private Sub Command0_Click()

If InputBox("enter the password") = "something" Then
Me!TabPageName.Visible = True
Else
MsgBox "sorry, Charlie"
End If

End Sub

hth


"Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
news:4A4007F9-FC26-4AAD-BBC1-F7260C09864D[ at ]microsoft.com...
> Thanks for that Ray, understood, but can you tell me how I incorporate the
> code Tina supplied into my existing "Onclick" event procedure as mentioned
in
> my previous reply. Also is it possible to have a similar procedure for
> opening a specific page within a "Ctrl Tab"?
>
> Thanks in advance
>
> "Ray Cacciatore" wrote:
>
> > Roger,
> >
> > Although the code provided by tina may appear to work, nothing stops
users
> > from running the query called "PLANNED GIVING WEEKLY" from the database
> > window. The code behind this button simply calls a query and opens it on
the
> > screen for users to edit.
> >
> > If you open the database window and click on the Queries tab, you'll
find a
> > query called "PLANNED GIVING WEEKLY", if you double-click it, it will
open
> > for you to edit. Nothing stops users from opening it from there. I'm
assuming
> > you took care of this "back door".
> >
> > Ray
> >
> > "Roger Bell" wrote:
> >
> > > Thanks for that Tina. How can I add the code you supplied to the
existing
> > > procedure that currently reads as follows:
> > >
> > > Private Sub ENTRE_WEEKLY_PLANNED_GIVING_Click()
> > > On Error GoTo Err_ENTRE_WEEKLY_PLANNED_GIVING_Click
> > >
> > > Dim stDocName As String
> > >
> > > stDocName = "PLANNED GIVING WEEKLY"
> > > DoCmd.OpenQuery stDocName, acNormal, acEdit
> > >
> > > Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > > Exit Sub
> > >
> > > Err_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > > MsgBox Err.Description
> > > Resume Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click
> > >
> > > End Sub
> > >
> > >
> > > "tina" wrote:
> > >
> > > > here's an example of one way to do it, as
> > > >
> > > > Private Sub Command0_Click()
> > > >
> > > > If InputBox("enter the password") = "something" Then
> > > > <do whatever the command button is supposed to do here>
> > > > Else
> > > > MsgBox "sorry, Charlie"
> > > > End If
> > > >
> > > > End Sub
> > > >
> > > > hth
> > > >
> > > >
> > > > "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> > > > news:82883FC1-BEB7-40CE-AB06-3CF5B2B452E9[ at ]microsoft.com...
> > > > > Could anyone tell me if it is possible to write some code into the
> > > > "Onclick"
> > > > > Event procedure that requires a password before the user can
access a
> > > > command
> > > > > Button or Ctrl Tab?
> > > > > Thanks for any help
> > > >
> > > >
> > > >


Re: Command Button Password
Roger Bell 22.09.2006 04:35:01
Thanks again Tina. The Command button is working fine thanks to your
expertise. However, I tried the code in the Tab Control as follows:
("Onclick event")

Private Sub Planned_Giving_Information_Change()
If Me!Planned_Giving_Information = 6 Then
If Not InputBox("Please enter Password") = "roger" Then
Me!Householder_1 = 0
MsgBox "Sorry, Incorrect Password"
End If
End If
End Sub

where Planned_Giving_Information is the name and has the value of 6.
Householder_1 has the value of 0. Obviously, I have got it wrong & would
appreciate your guidance again and thank you for your patience.

"tina" wrote:

[Quoted Text]
> > is it possible to have a similar procedure for
> > opening a specific page within a "Ctrl Tab"?
>
> well, pages in a tab control don't "open" and "close", you merely navigate
> from one to another. here's one way to stop the uninvited user from moving
> to a "protected" tab, as
>
> Private Sub TabCtl0_Change()
>
> If Me!TabCtl0 = 1 Then
> If Not InputBox("enter password") = "something" Then
> Me!TabCtl0 = 0
> MsgBox "sorry, Charlie"
> End If
> End If
>
> End Sub
>
> in the above example, the name of the tab control is TabCtl. each page in a
> tab control has an index value - the first page's index value is 0, the
> second page's value is 1, etc. the "value" of the tab control is the index
> value of the currently selected tab page. so the above code says: if the
> user clicks on the second tab page (which has an index value of 1), an input
> box will open for the password to be entered; if the password is not
> correct, the first tab page is selected instead; if the password IS correct,
> the second tab page is selected as the user intended.
>
> personally, i prefer to not show things to users that they can't actually
> get at - it just causes frustration. i'd be more likely to hide the
> "password-protected" page, and make it visible only when the correct
> password is provided. to do that, you can use a command button, something
> along the lines of
>
> Private Sub Command0_Click()
>
> If InputBox("enter the password") = "something" Then
> Me!TabPageName.Visible = True
> Else
> MsgBox "sorry, Charlie"
> End If
>
> End Sub
>
> hth
>
>
> "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> news:4A4007F9-FC26-4AAD-BBC1-F7260C09864D[ at ]microsoft.com...
> > Thanks for that Ray, understood, but can you tell me how I incorporate the
> > code Tina supplied into my existing "Onclick" event procedure as mentioned
> in
> > my previous reply. Also is it possible to have a similar procedure for
> > opening a specific page within a "Ctrl Tab"?
> >
> > Thanks in advance
> >
> > "Ray Cacciatore" wrote:
> >
> > > Roger,
> > >
> > > Although the code provided by tina may appear to work, nothing stops
> users
> > > from running the query called "PLANNED GIVING WEEKLY" from the database
> > > window. The code behind this button simply calls a query and opens it on
> the
> > > screen for users to edit.
> > >
> > > If you open the database window and click on the Queries tab, you'll
> find a
> > > query called "PLANNED GIVING WEEKLY", if you double-click it, it will
> open
> > > for you to edit. Nothing stops users from opening it from there. I'm
> assuming
> > > you took care of this "back door".
> > >
> > > Ray
> > >
> > > "Roger Bell" wrote:
> > >
> > > > Thanks for that Tina. How can I add the code you supplied to the
> existing
> > > > procedure that currently reads as follows:
> > > >
> > > > Private Sub ENTRE_WEEKLY_PLANNED_GIVING_Click()
> > > > On Error GoTo Err_ENTRE_WEEKLY_PLANNED_GIVING_Click
> > > >
> > > > Dim stDocName As String
> > > >
> > > > stDocName = "PLANNED GIVING WEEKLY"
> > > > DoCmd.OpenQuery stDocName, acNormal, acEdit
> > > >
> > > > Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > > > Exit Sub
> > > >
> > > > Err_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > > > MsgBox Err.Description
> > > > Resume Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click
> > > >
> > > > End Sub
> > > >
> > > >
> > > > "tina" wrote:
> > > >
> > > > > here's an example of one way to do it, as
> > > > >
> > > > > Private Sub Command0_Click()
> > > > >
> > > > > If InputBox("enter the password") = "something" Then
> > > > > <do whatever the command button is supposed to do here>
> > > > > Else
> > > > > MsgBox "sorry, Charlie"
> > > > > End If
> > > > >
> > > > > End Sub
> > > > >
> > > > > hth
> > > > >
> > > > >
> > > > > "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> > > > > news:82883FC1-BEB7-40CE-AB06-3CF5B2B452E9[ at ]microsoft.com...
> > > > > > Could anyone tell me if it is possible to write some code into the
> > > > > "Onclick"
> > > > > > Event procedure that requires a password before the user can
> access a
> > > > > command
> > > > > > Button or Ctrl Tab?
> > > > > > Thanks for any help
> > > > >
> > > > >
> > > > >
>
>
>
Re: Command Button Password
Roger Bell 22.09.2006 06:30:01
I actually found my Brain, which is rare, and got this to work. Thanks again
from the bottom of my heart for all your invaluable help. May all your days
be filled with Peace and Happiness.


"Roger Bell" wrote:

[Quoted Text]
> Thanks again Tina. The Command button is working fine thanks to your
> expertise. However, I tried the code in the Tab Control as follows:
> ("Onclick event")
>
> Private Sub Planned_Giving_Information_Change()
> If Me!Planned_Giving_Information = 6 Then
> If Not InputBox("Please enter Password") = "roger" Then
> Me!Householder_1 = 0
> MsgBox "Sorry, Incorrect Password"
> End If
> End If
> End Sub
>
> where Planned_Giving_Information is the name and has the value of 6.
> Householder_1 has the value of 0. Obviously, I have got it wrong & would
> appreciate your guidance again and thank you for your patience.
>
> "tina" wrote:
>
> > > is it possible to have a similar procedure for
> > > opening a specific page within a "Ctrl Tab"?
> >
> > well, pages in a tab control don't "open" and "close", you merely navigate
> > from one to another. here's one way to stop the uninvited user from moving
> > to a "protected" tab, as
> >
> > Private Sub TabCtl0_Change()
> >
> > If Me!TabCtl0 = 1 Then
> > If Not InputBox("enter password") = "something" Then
> > Me!TabCtl0 = 0
> > MsgBox "sorry, Charlie"
> > End If
> > End If
> >
> > End Sub
> >
> > in the above example, the name of the tab control is TabCtl. each page in a
> > tab control has an index value - the first page's index value is 0, the
> > second page's value is 1, etc. the "value" of the tab control is the index
> > value of the currently selected tab page. so the above code says: if the
> > user clicks on the second tab page (which has an index value of 1), an input
> > box will open for the password to be entered; if the password is not
> > correct, the first tab page is selected instead; if the password IS correct,
> > the second tab page is selected as the user intended.
> >
> > personally, i prefer to not show things to users that they can't actually
> > get at - it just causes frustration. i'd be more likely to hide the
> > "password-protected" page, and make it visible only when the correct
> > password is provided. to do that, you can use a command button, something
> > along the lines of
> >
> > Private Sub Command0_Click()
> >
> > If InputBox("enter the password") = "something" Then
> > Me!TabPageName.Visible = True
> > Else
> > MsgBox "sorry, Charlie"
> > End If
> >
> > End Sub
> >
> > hth
> >
> >
> > "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> > news:4A4007F9-FC26-4AAD-BBC1-F7260C09864D[ at ]microsoft.com...
> > > Thanks for that Ray, understood, but can you tell me how I incorporate the
> > > code Tina supplied into my existing "Onclick" event procedure as mentioned
> > in
> > > my previous reply. Also is it possible to have a similar procedure for
> > > opening a specific page within a "Ctrl Tab"?
> > >
> > > Thanks in advance
> > >
> > > "Ray Cacciatore" wrote:
> > >
> > > > Roger,
> > > >
> > > > Although the code provided by tina may appear to work, nothing stops
> > users
> > > > from running the query called "PLANNED GIVING WEEKLY" from the database
> > > > window. The code behind this button simply calls a query and opens it on
> > the
> > > > screen for users to edit.
> > > >
> > > > If you open the database window and click on the Queries tab, you'll
> > find a
> > > > query called "PLANNED GIVING WEEKLY", if you double-click it, it will
> > open
> > > > for you to edit. Nothing stops users from opening it from there. I'm
> > assuming
> > > > you took care of this "back door".
> > > >
> > > > Ray
> > > >
> > > > "Roger Bell" wrote:
> > > >
> > > > > Thanks for that Tina. How can I add the code you supplied to the
> > existing
> > > > > procedure that currently reads as follows:
> > > > >
> > > > > Private Sub ENTRE_WEEKLY_PLANNED_GIVING_Click()
> > > > > On Error GoTo Err_ENTRE_WEEKLY_PLANNED_GIVING_Click
> > > > >
> > > > > Dim stDocName As String
> > > > >
> > > > > stDocName = "PLANNED GIVING WEEKLY"
> > > > > DoCmd.OpenQuery stDocName, acNormal, acEdit
> > > > >
> > > > > Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > > > > Exit Sub
> > > > >
> > > > > Err_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > > > > MsgBox Err.Description
> > > > > Resume Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click
> > > > >
> > > > > End Sub
> > > > >
> > > > >
> > > > > "tina" wrote:
> > > > >
> > > > > > here's an example of one way to do it, as
> > > > > >
> > > > > > Private Sub Command0_Click()
> > > > > >
> > > > > > If InputBox("enter the password") = "something" Then
> > > > > > <do whatever the command button is supposed to do here>
> > > > > > Else
> > > > > > MsgBox "sorry, Charlie"
> > > > > > End If
> > > > > >
> > > > > > End Sub
> > > > > >
> > > > > > hth
> > > > > >
> > > > > >
> > > > > > "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> > > > > > news:82883FC1-BEB7-40CE-AB06-3CF5B2B452E9[ at ]microsoft.com...
> > > > > > > Could anyone tell me if it is possible to write some code into the
> > > > > > "Onclick"
> > > > > > > Event procedure that requires a password before the user can
> > access a
> > > > > > command
> > > > > > > Button or Ctrl Tab?
> > > > > > > Thanks for any help
> > > > > >
> > > > > >
> > > > > >
> >
> >
> >
Re: Command Button Password
"tina" <nospam[ at ]address.com> 23.09.2006 05:15:11
good job! and you're very welcome :)


"Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
news:5B9FFB4F-912B-4EA6-9495-47C7F8D87ACB[ at ]microsoft.com...
[Quoted Text]
> I actually found my Brain, which is rare, and got this to work. Thanks
again
> from the bottom of my heart for all your invaluable help. May all your
days
> be filled with Peace and Happiness.
>
>
> "Roger Bell" wrote:
>
> > Thanks again Tina. The Command button is working fine thanks to your
> > expertise. However, I tried the code in the Tab Control as follows:
> > ("Onclick event")
> >
> > Private Sub Planned_Giving_Information_Change()
> > If Me!Planned_Giving_Information = 6 Then
> > If Not InputBox("Please enter Password") = "roger" Then
> > Me!Householder_1 = 0
> > MsgBox "Sorry, Incorrect Password"
> > End If
> > End If
> > End Sub
> >
> > where Planned_Giving_Information is the name and has the value of 6.
> > Householder_1 has the value of 0. Obviously, I have got it wrong &
would
> > appreciate your guidance again and thank you for your patience.
> >
> > "tina" wrote:
> >
> > > > is it possible to have a similar procedure for
> > > > opening a specific page within a "Ctrl Tab"?
> > >
> > > well, pages in a tab control don't "open" and "close", you merely
navigate
> > > from one to another. here's one way to stop the uninvited user from
moving
> > > to a "protected" tab, as
> > >
> > > Private Sub TabCtl0_Change()
> > >
> > > If Me!TabCtl0 = 1 Then
> > > If Not InputBox("enter password") = "something" Then
> > > Me!TabCtl0 = 0
> > > MsgBox "sorry, Charlie"
> > > End If
> > > End If
> > >
> > > End Sub
> > >
> > > in the above example, the name of the tab control is TabCtl. each page
in a
> > > tab control has an index value - the first page's index value is 0,
the
> > > second page's value is 1, etc. the "value" of the tab control is the
index
> > > value of the currently selected tab page. so the above code says: if
the
> > > user clicks on the second tab page (which has an index value of 1), an
input
> > > box will open for the password to be entered; if the password is not
> > > correct, the first tab page is selected instead; if the password IS
correct,
> > > the second tab page is selected as the user intended.
> > >
> > > personally, i prefer to not show things to users that they can't
actually
> > > get at - it just causes frustration. i'd be more likely to hide the
> > > "password-protected" page, and make it visible only when the correct
> > > password is provided. to do that, you can use a command button,
something
> > > along the lines of
> > >
> > > Private Sub Command0_Click()
> > >
> > > If InputBox("enter the password") = "something" Then
> > > Me!TabPageName.Visible = True
> > > Else
> > > MsgBox "sorry, Charlie"
> > > End If
> > >
> > > End Sub
> > >
> > > hth
> > >
> > >
> > > "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in message
> > > news:4A4007F9-FC26-4AAD-BBC1-F7260C09864D[ at ]microsoft.com...
> > > > Thanks for that Ray, understood, but can you tell me how I
incorporate the
> > > > code Tina supplied into my existing "Onclick" event procedure as
mentioned
> > > in
> > > > my previous reply. Also is it possible to have a similar procedure
for
> > > > opening a specific page within a "Ctrl Tab"?
> > > >
> > > > Thanks in advance
> > > >
> > > > "Ray Cacciatore" wrote:
> > > >
> > > > > Roger,
> > > > >
> > > > > Although the code provided by tina may appear to work, nothing
stops
> > > users
> > > > > from running the query called "PLANNED GIVING WEEKLY" from the
database
> > > > > window. The code behind this button simply calls a query and opens
it on
> > > the
> > > > > screen for users to edit.
> > > > >
> > > > > If you open the database window and click on the Queries tab,
you'll
> > > find a
> > > > > query called "PLANNED GIVING WEEKLY", if you double-click it, it
will
> > > open
> > > > > for you to edit. Nothing stops users from opening it from there.
I'm
> > > assuming
> > > > > you took care of this "back door".
> > > > >
> > > > > Ray
> > > > >
> > > > > "Roger Bell" wrote:
> > > > >
> > > > > > Thanks for that Tina. How can I add the code you supplied to
the
> > > existing
> > > > > > procedure that currently reads as follows:
> > > > > >
> > > > > > Private Sub ENTRE_WEEKLY_PLANNED_GIVING_Click()
> > > > > > On Error GoTo Err_ENTRE_WEEKLY_PLANNED_GIVING_Click
> > > > > >
> > > > > > Dim stDocName As String
> > > > > >
> > > > > > stDocName = "PLANNED GIVING WEEKLY"
> > > > > > DoCmd.OpenQuery stDocName, acNormal, acEdit
> > > > > >
> > > > > > Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > > > > > Exit Sub
> > > > > >
> > > > > > Err_ENTRE_WEEKLY_PLANNED_GIVING_Click:
> > > > > > MsgBox Err.Description
> > > > > > Resume Exit_ENTRE_WEEKLY_PLANNED_GIVING_Click
> > > > > >
> > > > > > End Sub
> > > > > >
> > > > > >
> > > > > > "tina" wrote:
> > > > > >
> > > > > > > here's an example of one way to do it, as
> > > > > > >
> > > > > > > Private Sub Command0_Click()
> > > > > > >
> > > > > > > If InputBox("enter the password") = "something" Then
> > > > > > > <do whatever the command button is supposed to do
here>
> > > > > > > Else
> > > > > > > MsgBox "sorry, Charlie"
> > > > > > > End If
> > > > > > >
> > > > > > > End Sub
> > > > > > >
> > > > > > > hth
> > > > > > >
> > > > > > >
> > > > > > > "Roger Bell" <RogerBell[ at ]discussions.microsoft.com> wrote in
message
> > > > > > > news:82883FC1-BEB7-40CE-AB06-3CF5B2B452E9[ at ]microsoft.com...
> > > > > > > > Could anyone tell me if it is possible to write some code
into the
> > > > > > > "Onclick"
> > > > > > > > Event procedure that requires a password before the user can
> > > access a
> > > > > > > command
> > > > > > > > Button or Ctrl Tab?
> > > > > > > > Thanks for any help
> > > > > > >
> > > > > > >
> > > > > > >
> > >
> > >
> > >


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net