Results 1 to 13 of 13

Thread: Please Help!!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    26

    Question Please Help!!!

    Hello,

    I'm new to VB and I am having problems getting this login screen to work. I'm using VB 6.0 and Access 97. My comand button that is supose to find and compare the user information looks like this:

    Code:
    Private Sub login_Click()
    SearchSting = "User = " & Trim(txtUser.Text)
    If txtUser.Text <> "" Then
      Data1.Recordset.FindFirst SearchSting
      If Data1.Recordset.NoMatch = True Then
        MsgBox "Please Enter a Valid User Name"
      Else
        If optReg.Value = True Then
          Load register
          register.Show
        Else
          Load DBAdmin
          DBAdmin.Show
        End If
      End If
    End If
    End Sub
    I don't know what I'm doing wrong. If someone can help me out it would be cool. I have atach my login form and my login database in a zip file so you can take a look. Thanks for your help in advance!

    -123

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    You didn't state what the problem is?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    26
    It dosen't work. I get an error stationg:

    The Microsoft Jet database engine does not recognize <name> as a valid field name or expression. (Error 3070)
    I was trying to check the user name first but I need to check the username and password against the database. If a valid user and pass is found I need it to coppy the info from the groupo collumn in the database to a variable named userGroup. I have tried Seek and Find first. I have been trying to get this login to work for days with no sucess. Please help!

    -123

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    User is a tring field..soooo

    Code:
    SearchSting = "User = '" & Trim(txtUser.Text) & "'"
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    26
    Thank You! I can't beleive I didn't see that. but I'm happy it works now! Ok now how would I check for the password feild as well? I tried

    And "Pass ='" & Trim(txtPass.Text) & "'"

    add to what you just gave me but I got another error. Also I need to get the value of the User collumn and save it to a variable named userGroup. Please help! Thanks!

    -123

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    26
    OK I got the user/pass working all I need now is a was to stor the group

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    whats the error? Type Mismatch? If so you did this

    Code:
    SearchSting = "User = '" & Trim(txtUser.Text) & "'" And "Pass ='" & Trim(txtPass.Text) & "'"
    change it to this

    Code:
    SearchSting = "User = '" & Trim(txtUser.Text) & "' And Pass ='" & Trim(txtPass.Text) & "'"
    for your other question
    just put in your else for when login is correct

    userGroup = txtUser.Text
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    26
    no I dont need the user name as user group. I need the record contained in the Group collumn of the database to be set to userGroup.

    -123

  9. #9
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    you mean the group for the logged on user?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    26
    Yes. There are three columns in the database User | Pass | Group. When the User puts in a correct username and password then I need the group of that user to be saved to a variable so that I can use it throughout the program.

    -123

  11. #11
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    ahh

    Code:
    userGroup = Data1.Recordset("group")
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    26
    Thanks allot! My login is finish!

  13. #13
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    no problemo
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

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



Click Here to Expand Forum to Full Width