Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Password in a Text field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Linda - 24 Mar 2008 19:33 GMT
Hi,

I have created a form where it has a text field that is only for IT use.  So
when you click on the text box, it asks for a password.  The only problem I
am having is that when you enter an incorrect password, it still allows you
to type in the text field.  It will come up with a message that you have
entered an incorrect password, you click ok and it returns you to that text
box.  But it allows you to start entering instead of asking for the password
again.
Any suggestions?

Thanks
Linda
Nicholas Scarpinato - 24 Mar 2008 20:17 GMT
Please post the code for the text box (I'm assuming you're using the OnClick
event?), it will be much easier to help you if we can see the code.

> Hi,
>
[quoted text clipped - 9 lines]
> Thanks
> Linda
Linda - 24 Mar 2008 20:26 GMT
Here is the code:
Private Sub Text85_Enter()
Dim Password, Loggin
   Password = "Query"
   Loggin = InputBox("Enter password")
   If Loggin <> Password Then
       MsgBox "Sorry wrong password!!"
       Else
       DoCmd.GoToControl "Text85"
       End
   End If

End Sub

> Please post the code for the text box (I'm assuming you're using the OnClick
> event?), it will be much easier to help you if we can see the code.
[quoted text clipped - 12 lines]
> > Thanks
> > Linda
Nicholas Scarpinato - 24 Mar 2008 20:42 GMT
Comments inline:

> Here is the code:
> Private Sub Text85_Enter()
[quoted text clipped - 9 lines]
>
> End Sub

It looks like you're really not doing anything. The end is the same result,
it goes back to the textbox, because you're not telling it not to when the
password is incorrect. You need to add a line of code to move the focus away
from that textbox whenever the password is incorrect, something like:

Me![Text83].SetFocus

That way the user has to click back on the box again to get the password
screen. Also, your GoToControl command is pointless, once you've clicked on
the textbox, that control will have the focus. So if the password is correct,
that control will already be selected, which is also why you're having the
problem with the incorrect password.

Personally, I would change that textbox to being disabled, and enabling it
only if the password is correct through an OnClick event:

Private Sub Text85_Click()
Dim Password, Loggin
    Password = "Query"
    Loggin = InputBox("Enter password")
    If Loggin <> Password Then
        MsgBox "Sorry wrong password!!"
        Else
        Me![Text85].Enabled = True
        Me![Text85].SetFocus
    End If
End Sub

Just remember that you'll have to reset your control to Enabled = False
somewhere else in your code.

> > Please post the code for the text box (I'm assuming you're using the OnClick
> > event?), it will be much easier to help you if we can see the code.
[quoted text clipped - 12 lines]
> > > Thanks
> > > Linda
Nicholas Scarpinato - 24 Mar 2008 21:08 GMT
Bah... nevermind, setting it to Enabled = False won't work, the OnClick event
won't fire if the control is disabled. Sorry.

But changing the focus on the form will work for your original code.

> Comments inline:
>
[quoted text clipped - 59 lines]
> > > > Thanks
> > > > Linda
Linda - 26 Mar 2008 16:13 GMT
Thanks!! That worked!!!

> Comments inline:
>
[quoted text clipped - 59 lines]
> > > > Thanks
> > > > Linda
Golfinray - 24 Mar 2008 20:19 GMT
Try this:
Dim stpassword As String
    stpassword = inputbox("Enter Your Password")
    If stpassword = "areaa" Then
    DoCmd.OpenForm "manager a tracking", , , acnornmal
    Me.Visible = False
    Else: MsgBox "You Entered the wrong password", vbOKOnly
End If

> Hi,
>
[quoted text clipped - 9 lines]
> Thanks
> Linda
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.