Results 1 to 12 of 12
  1. #1
    Join Date
    Oct 2009
    Posts
    204

    Unanswered: Problem putting the pieces together--creating a login screen

    Hello, I have been teaching myself access and am still relatively new at some things....I am using 2007.

    What I am trying to do is create a login form that uses the name and password from a table. In the form is an unbound combo box that is tied to the data for the name in the table and an unbound text box used for entering the password.

    Table = DatabaseUsersTable
    Fields: DatabaseUser, DatabasePassword
    Form = Login Screen
    Fields: combo box = DatabaseName, password = DatabaseLogin

    I have a query (LoginQuery2) that takes the name from the combo box, and if the password entered into the text box in the form matches the password for that name in the table, returns the value "True"

    Fields in this query:
    DatabaseUser
    DatabasePassword
    True: IIf([Forms]![Login Screen]![DatabaseLogin]=[DatabasePassword],"True","False")

    What I want is to run a macro that will open form "Switchboard" if the value returned in [LoginQuery2]![True] is "True".

    I'm having trouble trying to figure out what to do next.....Someone I was talking to said to try a Dlookup but I couldn't figure out how to make the criteria work, and I wasn't able to understand over the phone.

    Can someone please give me an idea on what steps to take next? And if possible, try to keep it in macros.....I'm an idiot when it comes to VB.

    Thanks,
    Chris
    Last edited by chris07tibgs; 10-06-09 at 14:25.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    have you considered using the network logon? network authentication is almost certain to be stronger than your own designed logon & password function

    if you want to explore the network logon option then have a look at the code bank or do a google on dev asish api
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2009
    Posts
    204
    I was doing it this way since by using another form I can make it relatively easy for the users to go in and add another user without this being high maintenance for me.

    Could I do something like that with the network login?

  4. #4
    Join Date
    Oct 2009
    Posts
    204
    Searching for dev asish api I could not find anything resembling what I was looking for.....I'm sorry, but I have no idea what you are talking about. Could you please post an example?

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    my bad that should have read "dev ashish api"
    Google

    theres also code in the access code bank on this forum.

    if you sue the network logon there is no need for any manual intervetion, unless you are restricting access within the applicaetion based on Userid's.. it depends what your need for the userid is.

    historically Ive entered the netwrok logon name into a wrokgroup fiel, assigned permissions to that userid and then queried the permissions with the network logon. for the user its seemless, they don't neccesarily even know there application is being filtered on the logon.

    the real advantage is that youdon't have to rely on an internal table which is easily modified.
    I'd rather be riding on the Tiger 800 or the Norton

  6. #6
    Join Date
    Oct 2009
    Posts
    204
    Quote Originally Posted by healdem
    my bad that should have read "dev ashish api"
    Google

    theres also code in the access code bank on this forum.

    if you sue the network logon there is no need for any manual intervetion, unless you are restricting access within the applicaetion based on Userid's.. it depends what your need for the userid is.

    historically Ive entered the netwrok logon name into a wrokgroup fiel, assigned permissions to that userid and then queried the permissions with the network logon. for the user its seemless, they don't neccesarily even know there application is being filtered on the logon.

    the real advantage is that youdon't have to rely on an internal table which is easily modified.
    The reason I want to do it through a table and a form is cuz I'm completely clueless when it comes to VBA, so as soon as you start talking about that my only response is "Der....what?"

    I checked out what you said to google, but unfortunately I have no idea what I'm looking for on there, so none of it makes sense to me.

    I guess what I want to do is open the switchboard with a button and a macro....I'm trying to put conditions on the macro but nothing I can think of to try is working. Can you tell me what my macro should look like?

  7. #7
    Join Date
    Oct 2009
    Posts
    204
    Bump......

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    If you can use macros, you can get started with VBA. VBA is not that hard. The first command you want to know about is DoCmd. This provides all the MACRO ACTIONS. In other words, since you are use to macro commands, just type DoCmd and then a dot and you will see all your macro actions.

    Stop copping out. Stop dodging. Just do it. No more excuses.

    Why? Because MACROS completely and totally f***ing SUCK!!

    If you need help, ask, but I refuse to help anyone write macros when VBA is so much more flexible... and searchable... and transportable (tiz just text).

    Code:
    If [Forms]![Login Screen]![DatabaseLogin]=DLookup("DatabasePassword","DatabaseUsersTable","DatabaseUser = """ & Me.DatabaseName & """") Then
       MsgBox "True"
    Else
       MsgBox "False"
    End If
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    Oct 2009
    Posts
    204
    Quote Originally Posted by StarTrekker
    If you can use macros, you can get started with VBA. VBA is not that hard. The first command you want to know about is DoCmd. This provides all the MACRO ACTIONS. In other words, since you are use to macro commands, just type DoCmd and then a dot and you will see all your macro actions.

    Stop copping out. Stop dodging. Just do it. No more excuses.

    Why? Because MACROS completely and totally f***ing SUCK!!

    If you need help, ask, but I refuse to help anyone write macros when VBA is so much more flexible... and searchable... and transportable (tiz just text).

    Code:
    If [Forms]![Login Screen]![DatabaseLogin]=DLookup("DatabasePassword","DatabaseUsersTable","DatabaseUser = """ & Me.DatabaseName & """") Then
       MsgBox "True"
    Else
       MsgBox "False"
    End If
    Okay let's see if I am reading this right....

    If the macro to open the switchboard and close login screen is LoginMacro, then I do this? And if I change the text "False" after MsgBox the box will return whatever text I type in when it appears? Please tell me if I am correct, it will help me sleep better before I can try this at work tomorrow


    Code:
    If [Forms]![Login Screen]![DatabaseLogin]=DLookup("DatabasePassword","DatabaseUsersTable","DatabaseUser = """ & Me.DatabaseName & """") Then
       DoCmd.LoginMacro
    Else
       MsgBox "False"
    End If
    Thanks for your help.

  10. #10
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    More like this:

    Code:
    If [Forms]![Login Screen]![DatabaseLogin] = DLookup("DatabasePassword", "DatabaseUsersTable", "DatabaseUser = """ & Me.DatabaseName & """") Then
       DoCmd.OpenForm "Switchboard"
       DoCmd.Close acForm, Me.Name
    Else
       MsgBox "Incorrect Username/Password combination."
    End If
    There is a "RunMacro" command somewhere too... but I dunno where it is ^^
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  11. #11
    Join Date
    Oct 2009
    Posts
    204
    Quote Originally Posted by StarTrekker
    More like this:

    Code:
    If [Forms]![Login Screen]![DatabaseLogin] = DLookup("DatabasePassword", "DatabaseUsersTable", "DatabaseUser = """ & Me.DatabaseName & """") Then
       DoCmd.OpenForm "Switchboard"
       DoCmd.Close acForm, Me.Name
    Else
       MsgBox "Incorrect Username/Password combination."
    End If
    There is a "RunMacro" command somewhere too... but I dunno where it is ^^
    You, sir, are a genius and a great help...it works exactly as I need it to! Thanks a lot!!

    I'm actually starting to try to learn to read code.....I was dreaming last night about dim as string, cancel as integer.... o_O

  12. #12
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Excellent!!

    You have taken your first steps into a much larger world... and a much more flexible one. And it wasn't THAT hard was it?!

    Soon, you will be leaving macros behind

    Cheers!
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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