dcsimg
Results 1 to 39 of 39

Thread: [RESOLVED]Run-time error '-2147217865(80040e37)'

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Resolved [RESOLVED]Run-time error '-2147217865(80040e37)'

    this is the code for my module, i dont know what is really my problem.. can anyone help me? the error said "The Microsoft Jet Database engine cannot find the input table or query 'tblLogIn'. Make sure it exist and its name is spelled correcty..
    Code:
    'Login
    Sub initLogForm(ByRef conConnection As ADODB.Connection, ByRef cmdCommand As ADODB.Command, ByRef rsRecordset As ADODB.Recordset, ByRef sqlString As String)
        conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\inventory system\inventory system.mdb;Persist Security Info=false"
        conConnection.CursorLocation = adUseClient
        conConnection.Open
        
        With cmdCommand
            .ActiveConnection = conConnection
            .CommandText = sqlString
            .CommandType = adCmdText
        End With
        
        With rsRecordset
            .CursorType = adOpenStatic
            .CursorLocation = adUseClient
            .LockType = adLockOptimistic
            
            
            .Open cmdCommand
        End With
    End Sub

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    Well you did not show us the sqlString which is where the problem would be. The error insicates a problem with the table name in the sqlString.


    If your string is something like
    Code:
    Select * from 'tblLogIn' .....
    Then that would be the source of the problem. No quotes should be used on table names it should be like
    Code:
    Select * from tblLogIn .....

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by DataMiser View Post
    Well you did not show us the sqlString which is where the problem would be. The error insicates a problem with the table name in the sqlString.


    If your string is something like
    Code:
    Select * from 'tblLogIn' .....
    Then that would be the source of the problem. No quotes should be used on table names it should be like
    Code:
    Select * from tblLogIn .....
    this is my code for log in button
    Code:
    Private Sub Command1_Click()
    'Correct BackColor
        Text2.BackColor = &HFFFFFF
        Text3.BackColor = &HFFFFFF
        
        Dim conConnection As New ADODB.Connection
        Dim cmdCommand As New ADODB.Command
        Dim rsRecordset As New ADODB.Recordset
        Dim sqlString As String
        
        sqlString = "SELECT * FROM tblLogIn WHERE Username like '" & Text2.Text & "'"
        
        initLogForm conConnection, cmdCommand, rsRecordset, sqlString
        
        If rsRecordset.EOF = False Then
            'Checking the form
            With Text2
                If .Text = "" Then
                    MsgBox "Please Fill the Form"
                    .BackColor = &H80FFFF
                    .Text = ""
                    .SetFocus
                End If
            End With
            
            With Text3
                If .Text = "" Then
                    MsgBox "Please Fill the Form"
                    .BackColor = &H80FFFF
                    .Text = ""
                    .SetFocus
                End If
            End With
            'Check the username if is correct
            If rsRecordset.Fields(1) = Text2.Text And rsRecordset.Fields(2) = Text3.Text Then
                Main.Show 'show of splash screen
                UserType = rsRecordset.Fields(3)
                If UserType = "User" Then
                
                           End If
                Unload Me
            Else
                MsgBox "Incorrect Username or Password!"
            End If
                      
        Else
            'If the username is invalid / wrong
            'If record is not found message displays
                MsgBox "Incorrect login or password! Please try again.", vbCritical, "Password Error Message"
                'count number of tries
                try = try + 1
                 'Allows only 3 tries, then application stops
                     If try >= 3 Then
                         MsgBox "CAUTION:  you entered 3 try. This System will be automatically terminated, Thank you and Goodbye!!!", vbOKOnly, "WARNING: Password Error Message"
                       End
                     End If
                     Text2.SetFocus
                       Exit Sub
        End If
        
        xnitLogForm conConnection, cmdCommand, rsRecordset
        Text3.Text = ""
        On Error GoTo ErrorHandler
    Exit Sub
    
    ErrorHandler:
    MsgBox "Error Number: " & Err.Number & " With The Description ->> " & Err.Description & " <<- Occured."
    End Sub

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    So do you have a table named tblLogin in D:\inventory system\inventory system.mdb ?

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    yes,

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    add a line just above the open statement where you are getting an error
    Code:
    Debug.Print sqlString
    and see what prints out in the debug window then let us know.
    It is possible that there is another issue in that string but the error is pretty specific.

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by DataMiser View Post
    add a line just above the open statement where you are getting an error
    Code:
    Debug.Print sqlString
    and see what prints out in the debug window then let us know.
    It is possible that there is another issue in that string but the error is pretty specific.
    nothing happened sir, just the same error.

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    It you put that line in the code right above where the error was occurring then it would have written something to your debug window. If it did not then that would mean either you are getting an error somewhere else or you are not looking at the debug/immediate window or you entered it incorrectly.

  9. #9

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    i really dont know where's the error, if you dont mind.. can i send it to you and analyze it yourself please?

  10. #10
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    You highlighted it in your first post

    Code:
    .Open cmdCommand
    You should insert the debug.print sqlString on the line above like so
    Code:
    Debug.Print sqlString
    .Open cmdCommand

  11. #11

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    that is what i did sir,

  12. #12
    Fanatic Member
    Join Date
    Dec 2007
    Location
    West Yorkshire, UK
    Posts
    790

    Re: Run-time error '-2147217865(80040e37)'

    The immediate window is in the program you are using to write your application. It shows at the bottom. When you use Debug.Print, it prints the result of the Debug.Print statement there, not in your application nor in a messagebox. When you run your program, you will see the VB development area BEHIND YOUR program. If you look in the bottom left corner, as per the screenshot I include, you will see the result of the Debug.Print

  13. #13
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,118

    Re: Run-time error '-2147217865(80040e37)'

    To show the Debug window press CTRL G

  14. #14
    Addicted Member ryanframes's Avatar
    Join Date
    Apr 2012
    Posts
    208

    Re: Run-time error '-2147217865(80040e37)'

    the error number is talking about that the connection has failed or disconnected.
    check ur connection database..

  15. #15
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by ryanframes View Post
    the error number is talking about that the connection has failed or disconnected.
    check ur connection database..
    The first post says that the error message was
    the error said "The Microsoft Jet Database engine cannot find the input table or query 'tblLogIn'. Make sure it exist and its name is spelled correcty..
    This does not indicate a failed connection. It indicates a bad table name in the sekect string.

    What is the exact error message that is appearing when you run the program now?

  16. #16
    Addicted Member ryanframes's Avatar
    Join Date
    Apr 2012
    Posts
    208

    Re: Run-time error '-2147217865(80040e37)'

    ops soryy, not read the first thread,,
    when i saw the err number its look like the connection error number,,
    but when i check my program its different..

    if it so ,well he should check the table name and the database right ??

  17. #17

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    it is connected to my database, and the table name is correct.. but still it has an error saying : "The Microsoft Jet Database engine cannot find the input table or query 'tblLogIn'. Make sure it exist and its name is spelled correcty.."

  18. #18

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by Bobbles View Post
    To show the Debug window press CTRL G
    i already did that sir to show the debug window, but when i run the program. nothing has displayed on the debug window.. nothing happened..

  19. #19
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,118

    Re: Run-time error '-2147217865(80040e37)'

    Can you paste your latest code (or attach it), hopefully including the Debug.print line of code.
    Forgive me for not reading all the above posts (I just woke up).
    Are you using Option Explicit ?
    Are you running the program by doing ALT fsrf
    (Holding down the ALT key and asking for File Save Run with Full compile)

    Can you prepare a trimmed down copy of your program, that demonstrates the same problem, and attach it for us to run ourselves.
    GUARANTEED to help solve the problem

  20. #20
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    So based on the error message it sounds like that table is not in the database you are connecting to. You should double check the path and open the db at that location and make sure that the table is there and that the spelling is correct. This is the most likely source of the problem.

    Beyond that you need to learn how to use the debugger, to step through the code, look at the values of variables and use the debug.print if needed to show a value in the immeadiate window.

    If the error occured on the line you have highlighted in your first post and you placed that debug.print line directly above the line where the error occurred then run the program you will most certianly get an output in the debug window.

    So either you did not put it in the right place or the error is not occurring on the indicated line.

  21. #21

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by Bobbles View Post
    Can you paste your latest code (or attach it), hopefully including the Debug.print line of code.
    Forgive me for not reading all the above posts (I just woke up).
    Are you using Option Explicit ?
    Are you running the program by doing ALT fsrf
    (Holding down the ALT key and asking for File Save Run with Full compile)

    Can you prepare a trimmed down copy of your program, that demonstrates the same problem, and attach it for us to run ourselves.
    GUARANTEED to help solve the problem
    sir, i attached my whole system that i am making.. the error is on the log in form.. or form1. please help me,
    Attached Files Attached Files

  22. #22
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,118

    Re: Run-time error '-2147217865(80040e37)'

    Been charging the car battery.
    Downloading now to have a look at it

  23. #23

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    thanks

  24. #24
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,118

    Re: Run-time error '-2147217865(80040e37)'

    I have it working.
    Just cleaning up a few things for you

  25. #25

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    working? then, why mine is not working?
    thank you sir

  26. #26
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,118

    Re: Run-time error '-2147217865(80040e37)'

    I'm in a bit of a pickle at the moment.
    I will list the problems I found soon.
    One of the later problems was not using meaningful names for the textboxes EG Text2 and Text3
    Whilst doing global renames of those in the code, I stuffed it.
    So I am starting afresh with your code, and doing the fixes again.
    Bear with me, whilst I am doing that

  27. #27

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    i forgot to rename my text boxes, but because there are few text boxes on 1 form so i didn't mind renaming them .

  28. #28
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,118

    Re: Run-time error '-2147217865(80040e37)'

    See attached.
    Explanations will follow
    Attached Files Attached Files

  29. #29
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,118

    Re: Run-time error '-2147217865(80040e37)'

    Before running it ensure that you rename the DB and the folder, TO GET RID OF SPACES, and case possible problems. EG -
    D:\Inventory_system\Inventory_system.mdb

    Don't use spaces in any names
    Don't use names that can confuse VB6 or me
    Make the Form internal name the same as the file name
    tblLogin should be Login
    Use meaningful names for controls such as txtUsername and txtPassword
    I have gotten rid of Fields(3) whatever, and used the bang character !
    !Username
    When you do that, and have meaningful textbox names, you could not get them mixed up, even if you were both drunk and high (or old like me).
    Last edited by Bobbles; Jun 12th, 2012 at 11:35 PM.

  30. #30

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    Big thanks to all of you,

  31. #31
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    So what was the problem?

  32. #32
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,118

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by DataMiser View Post
    So what was the problem?
    There were a few potential problems, and conventions(lack thereof) that could have been causing problems, or by their nature were extremely prone to causing problems.
    My main focus was to fix those poor areas, and then run it with full compile, fixing lines where it crashed.
    My post 29 covers most of the areas I 'fixed'
    I also replaced the connection code, rather than try to fix it.
    Thus, I did not try to nail down what exactly was causing the error(s), I was just trying to fix it all.

    aldryn05 probably has studied my code, and compared it to his, so he might be in a better position to describe what he thinks was causing the error(s)

    Regards,
    Rob
    Last edited by Bobbles; Jun 13th, 2012 at 11:23 AM.

  33. #33
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    I was just curious as the initial post said that the error was complaining about the table name not being there and then he said that the debug.print sqlstring did not show anything.

    Was the table actually Named Login or was it tblLogin in the database?

  34. #34
    Frenzied Member
    Join Date
    Dec 2008
    Posts
    1,118

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by DataMiser View Post
    I was just curious as the initial post said that the error was complaining about the table name not being there and then he said that the debug.print sqlstring did not show anything.

    Was the table actually Named Login or was it tblLogin in the database?
    You're right on to it.
    The Table name in the DB was Login, and correcting tblLogin to Login was one of the code changes I made.

  35. #35
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    That's kind of funny. In my second post I asked
    Quote Originally Posted by DataMiser View Post
    So do you have a table named tblLogin in D:\inventory system\inventory system.mdb ?
    To which he replied Yes

    Always makes it a bit difficult when the info being provided is not accurate.

    All he had to do was look in the database and see what the table name was and he would have been past that error.

  36. #36

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by DataMiser View Post
    That's kind of funny. In my second post I asked
    To which he replied Yes

    Always makes it a bit difficult when the info being provided is not accurate.

    All he had to do was look in the database and see what the table name was and he would have been past that error.
    HEHEHE, im sorry.. but, thanks! i just thought that when you're into table.. you should include tbl to your fieldname..

  37. #37
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,371

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by aldryn05 View Post
    HEHEHE, im sorry.. but, thanks! i just thought that when you're into table.. you should include tbl to your fieldname..
    No problem, and yes it is good to include tbl in your naming convention but your code must match the database or it will not work

    For example if I were writing an app that had a login feature most likely the table would be named tblUsers and when I access it through code I would reference tblUsers.

  38. #38

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    Quote Originally Posted by Bobbles View Post
    There were a few potential problems, and conventions(lack thereof) that could have been causing problems, or by their nature were extremely prone to causing problems.
    My main focus was to fix those poor areas, and then run it with full compile, fixing lines where it crashed.
    My post 29 covers most of the areas I 'fixed'
    I also replaced the connection code, rather than try to fix it.
    Thus, I did not try to nail down what exactly was causing the error(s), I was just trying to fix it all.

    aldryn05 probably has studied my code, and compared it to his, so he might be in a better position to describe what he thinks was causing the error(s)

    Regards,
    Rob
    yeah, im still studying and comparing it until now.. im thinking on how did you know what really the problem, aside from the table name.. i am really not good in visual basic, i need to study more about vb and codes...

  39. #39

    Thread Starter
    Member
    Join Date
    Jun 2012
    Location
    San Pedro, Laguna, Philippines
    Posts
    62

    Re: Run-time error '-2147217865(80040e37)'

    big thanks for both of you mr. datamiser and mr. bobbles. i learned a lot, but still i have to study more..

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width