Results 1 to 9 of 9
  1. #1
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple question regarding a text box (2000)

    Can't believe I'm asking this but can I find the solution..can I heck!
    I have a password textbox that opens a form. If the word is correct ,something like:

    If Me.TxtPassword = "password" Then...............

    The user then clicks a control to proceed to the next form. I'd like to set TxtPassword to Null. Effectively everytime the user enters the correct password and proceeds to the next form (FrmEmployeeDetails) , then the password is cleared. Therefore anyone who happens to use the database in the meantime will not be able to access FrmEmployeeDetails.

    I've tried:

    Me.CmdPassword=Null in various events (After Update, On Exit etc, either through the form or the command button itself................)

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Simple question regarding a text box (2000)

    Are you running the database as a front end - back end or perhaps on a network setup as a multi user. In either event, you are trying to lock a form if someone is already accessing it.

    The only way I can think to do this is to have a table that contains form names and a column for status. Status (default 1) could be 1 for available and 0 if being used. After a user inputs the correct password, your code could read if Password = Password and Status = 1, then open the form.

    In the on open event of the form, update the status of the form in the table to 0. Thus, nobody else could open the form when being used.
    In the on exit or close event of the form, update the status of the form in the table back to 1 so the form is available again.



    HTH
    Regards,

    Gary
    (It's been a while!)

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Simple question regarding a text box (2000)

    It seems to me you are trying to disable the multi-user capability of Access - can you give us some insight as to why. If you really want to do that (and I still want to know why), then open the database exclusively each time, and that way only one user at a time can use it. But you are disabling the single most powerful feature in Access - namely two or several people can work on the data at the same time.
    Wendell

  4. #4
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple question regarding a text box (2000)

    Oops, a bit of a misunderstanding.
    I have disabled the bypass feature in Access so that the design elements of my database cannot be altered by pressing the Shift key on opening.
    However, I have a FrmPassword that is entered by double clicking on a graphic in the main form. Once the user enters the password in this form, they click a control that links them to another form where you can enable/disable the bypass feature.
    In FrmPassword I have a control where the coding is:
    If Me.TxtPassword = "password" Then..............and so on.
    This way I can enter the design of the database by altering the value in the linking form.
    Currently once the user enters the password and is then redirected to the next form(FrmBypass), on exiting this, is returned to FrmPassword. The password is still displayed in TxtPassword. It is this that I would like to clear

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Simple question regarding a text box (2000)

    <hr>Currently once the user enters the password and is then redirected to the next form(FrmBypass), on exiting this, is returned to FrmPassword. The password is still displayed in TxtPassword. It is this that I would like to clear.<hr>
    1. Why is that a problem? The user knew the correct password, so there is no objection that it is still there.
    2. Do you need to keep frmPassword open? If you would close it, txtPassword would be cleared the next time frmPassword is opened.
    3. You could set PASSWORD as Input Mask for txtPassword. This will cause the password to be displayed as *****.
    4. I assume that you open frmBypass using DoCmd.OpenForm. You could use code like this:

    If Me.txtPassword = "password" Then
    DoCmd.OpenForm "frmBypass", ...
    Me.txtPassword = Null
    End If

  6. #6
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple question regarding a text box (2000)

    Thanks again Hans.
    1. I wanted this cleared so that frmBypass wouldn't be accessible if the user were to leave his/her machine on this specific form.
    2. Nope, not too sure how to close it though, I've had a look through the DoCmd and can find no commands for closing the form.
    3. I'd already done this, but wanted to make sure that although only the ***** would be displayed, that the password was still not entered in the text box. How I'd designed it, upon re-entry into the form from frmBypass, the ******* was still displayed in the textbox.
    4. This works fine, it was similar to what I was doing yesterday, I guess that I placed the Me.TxtPassword = Null in the incorrect place.
    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Simple question regarding a text box (2000)

    Although you may not need it any more, here is how to do close frmPassword after opening frmByPass:

    If Me.txtPassword = "password" Then
    DoCmd.OpenForm "frmBypass", ...
    DoCmd.Close acForm, Me.Name
    End If

    Since you already opened another form, you must specify explicitly which form you want to close using DoCmd.Close. Me.Name refers to the form running the code, in this case frmPassword.

  8. #8
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Simple question regarding a text box (2000)

    No, thats great!
    In some circumstances I think it looks untidy when you're returned to a form after exiting it, just because its linked through a control. Although this obviously doesn't apply to all forms.
    Makes me sound a bit like a control freak though! <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

  9. #9
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Simple question regarding a text box (2000)

    Ah - that's a different kettle of fish. And it looks like you've sorted most of the issue overnight. Just one point to add - as I understand it a clever user/developer can easily reset the SHIFT by-pass from another database using code, so I wouldn't fret too much about someone finding the password.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •