Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show Textbox Value

Status
Not open for further replies.

madhouse

Programmer
Sep 17, 2002
165
GB
I have an Access database for storing system profiles and passwords. On the main form I'm using a subform to list all the system profiles, passwords and date the password was last updated. What I want to have is a button for each record on the subform to "reveal" the password for the corresponding profile. Since only certain authorised users will have access to the database, the idea of this is in case someone tried to look over the shoulder of an authorised user.
I've got as far as hiding the passwords by setting txtPassword.visible = False when the subform opens, and I've now got a command button next to each record. But I'm not sure the best way of using the command button to reveal the password. What I was hoping to have is when the command button is pressed down the password is revealed, and then when the command button is released the password is hidden again. Alternatively, maybe there is some way of using a timing function so that when the command button is pressed the password is revealed then after 5 seconds the password then gets hidden.

Any help (sample code) would be appreciated.
 
Try this,
for each button you mention, you could use the MouseDown and MouseUp events. Something like:

Code:
Private Sub yourCmdBtn_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    txtPassword.visible = True
End Sub

Private Sub yourCmdBtn_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    txtPassword.visible = False 
End Sub

I'm expecting your textbox txtPassword will only be visible while you press and hold the button yourCmdBtn .


 
That works fine (didn't even think of using Mouse Down and Mouse Up) except when you click one command button it reveals that passwords for all of the records and not just the one which the command button corresponds to. Is there a way of just "revealing" the password for a single record as opposed to all of them?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top