Results 1 to 11 of 11
  1. #1
    Join Date
    Aug 2006
    Posts
    559

    Unanswered: Runtime error but can't figure it...

    I'm getting a runtime error whenever I try to log into the attached DB. If you download it, and then run the frmUserLogon, you'll see what I mean. I can't figure out for the life of me what is causing the error, why, or HOW TO FIX IT.

    Anyone got any ideas?

    To login, use the user name: Bryan.Tysz
    Password: 37Jek!*T4g

  2. #2
    Join Date
    Aug 2006
    Posts
    559
    Let's try uploading this AGAIN!
    Attached Files Attached Files

  3. #3
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580

    Question References?

    Have you checked for missing references?

    Go to the VBA window - ALT + F11

    Then Tools > References and see if anything is listed as missing
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  4. #4
    Join Date
    Aug 2006
    Posts
    559
    Quote Originally Posted by garethdart
    Have you checked for missing references?

    Go to the VBA window - ALT + F11

    Then Tools > References and see if anything is listed as missing
    How do I tell if anything is missing? Please don't say by not having a check in the box because there are TONS of those!

  5. #5
    Join Date
    Sep 2002
    Location
    South Wales
    Posts
    580

    Exclamation Missing references

    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  6. #6
    Join Date
    Aug 2006
    Posts
    559
    Quote Originally Posted by garethdart
    The error occurs on this function, highlighted where it's RED:

    Code:
    Function isPasswordOK(PWPassed As String) As Boolean
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    Dim strSQL As String
    strSQL = "Select * from tblSecurity where User_Name = '" & fOSUserName() & "'"
    rs.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockReadOnly
    If PWPassed = rs!Password Then
        isPasswordOK = True
    Else
        isPasswordOK = False
    End If
    rs.Close
    Set rs = Nothing
    End Function

  7. #7
    Join Date
    Mar 2005
    Location
    Phoenix AZ
    Posts
    56
    I think there is a problem with your user ID field. It picked up my network login ID and even when I changed to Bryan.Tysz and reproduced the error, it was still holding my user ID in the variable in the debugger.

  8. #8
    Join Date
    Aug 2006
    Posts
    559
    Quote Originally Posted by bdb04
    I think there is a problem with your user ID field. It picked up my network login ID and even when I changed to Bryan.Tysz and reproduced the error, it was still holding my user ID in the variable in the debugger.
    I figured it was something with that but the issue is that the machine I'm developing it on is NOT on the network because this network has ... issues...

    I actually copied that opening portion from a DB that I did at my last job and it worked well so that's what I wanted on this one. They're putting in a new network here so hopefully it'll work on that one. I guess I'll try and test this DB on the one machine that I have here that is on the new network.

    **EDIT**

    Just tried it on my networked PC and it went through fine. Just had to switch a frmSplashScreen to frmMainMenu and it went through. So...I guess if I want to finish and continue being able to test this, I'm going to have to use that computer and piss everyone off! Oh well..! ;(
    Last edited by Grafixx01; 09-12-08 at 15:38.

  9. #9
    Join Date
    Aug 2006
    Posts
    559
    And it's back to not working again! All I did was to add some code to HIDE the frmMainMenu while it prompts the user if they wish to display the New Entries. Then UnHide it if they click "No" or when they click "Print" or "Continue-Main Menu" from the frmNewEntries....

    ARGH!!! This is starting to make me pissed off! Just don't understand why it works from the one DB that I had done a year ago but it won't work from this one!

  10. #10
    Join Date
    Mar 2005
    Location
    Phoenix AZ
    Posts
    56
    Is it the same type of error you were having before? Unless you changed something from when I downloaded it, the network login stays held in that procedure, so if you are trying to log in as someone other than yourself, it doesn't appear you would be able to.

  11. #11
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    strSQL = "Select * from tblSecurity where User_Name = '" & fOSUserName() & "'"
    Well there are a number of problems with this line of code.

    One is that there is no such field as User_Name in your tblSecurity.

    Another is that you seem to be confused about what you're doing. The fOSUserName() thing returns the user logged into windows, yet you've got a tblSecurity that has usernames and passwords. You're looking for the user logged into windows in your tblSecurity table yet you're having the user enter their login name? Which is it you want to do?!!

    When I changed this line of code to this:

    strSQL = "Select * from tblSecurity where UserID = '" & Forms!frmUserLogon.txtUser & "'"

    It at least accepted the login details in post #1.
    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
  •