Results 1 to 8 of 8
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Another Front End (A2K)

    Working from my Front End called “SRT Systems” what I’m attempting to do is open another Front End called AWS07_PRoberts.mdb” using the following :


    Private Sub txtKeyZ_Click()
    Dim app As New Access.Application
    app.OpenCurrentDatabase "S:SRT AccessSystemsSRT ServerAWS07_PRoberts.mdb"
    app.DoCmd.Maximize
    app.RunCommand acCmdAppMaximize
    app.Visible = True
    Set app = Nothing
    End Sub

    And it works very nicely.

    Two things that I would like to be able to do at this point are:

    1. Have my “Click” button passworded, and
    2. Close my Front End

    I’d appreciate any help on this,
    Cheers,
    Andy

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

    Re: Open Another Front End (A2K)

    I guess I'll refrain from asking why you want to do this... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    You could do something like this at the beginning of the procedure:

    Dim strPW As String
    strPW = InputBox("Please enter your password")
    If Not strPW = "topSecret" Then
    MsgBox "Get away from me, you impostor!", vbExclamation
    Exit Sub
    End If

    And at the end of the procedure, you could put an instruction

    Quit

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Another Front End (A2K)

    Hans,

    I'm not sure which I'm most impressed with, your, as always, correct answer or
    your ability to refrain asking me why I do these things.

    Now if I could get my wife to refrain from ......

    <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>
    Cheers,
    Andy

  4. #4
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Another Front End (A2K)

    Hans,

    This is an afterthought, which had I been clever, would have been a forethought.

    Is there anyway to use your code which works perfectly to "display" asterisks as the password is being typed in?
    Cheers,
    Andy

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

    Re: Open Another Front End (A2K)

    InputBox cannot do that. You'd have to use a text box on the same form that contains txtKeyZ, and set the Input Mask property of the text box to Password. It will then display an asterisk for each character entered.

    Let's say that you name the text box txtPassword. The part

    Dim strPW As String
    strPW = InputBox("Please enter your password")
    If Not strPW = "topSecret" Then
    MsgBox "Get away from me, you impostor!", vbExclamation
    Exit Sub
    End If

    would change to

    If Not Me.txtPassword = "topSecret" Then
    MsgBox "Get away from me, you impostor!", vbExclamation
    Exit Sub
    End If

  6. #6
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Another Front End (A2K)

    Hans,

    Worked beautifully! I did however set the default value of txtPassword to " ", because if I hit enter without anything there, it opened up the form without a password. I may have done something incorrectly to cause this problem, but my "solution" worked.

    Thanks again and
    Cheers,
    Andy

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

    Re: Open Another Front End (A2K)

    You could also build in a check to test whether the text box is blank (at the beginning of the On Click event procedure):

    If IsNull(Me.txtPassword) Then
    MsgBox "Please enter a password!", vbExclamation
    Me.txtPassword.SetFocus
    Exit Sub
    End If

  8. #8
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Another Front End (A2K)

    Thanks again Hans. Another arrow into the Access quiver,
    Cheers,
    Andy

Posting Permissions

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