How do I debug VB error #80004005

  • Thread starter Thread starter slintz
  • Start date Start date
S

slintz

Guest
According to my research, VB error 80004005 (-2147467259) is an "Unspecified Error" - which isn't exactly helpful :mad: The error description in the VB error pop-up is a bit better, giving "Method 'Open' of object '_Recordset' failed" (I mean "very little bit" better :rolleyes: ).

Here's the (pared down) code fragment (the error shows up on the Open methon):

Code:
Private Sub Button1_Click()

    Dim recset As ADODB.Recordset
    Set recset = New ADODB.Recordset
    
    With recset
        .ActiveConnection = CurrentProject.connection
        .CursorType = adOpenKeyset
        .LockType = adLockOptimistic
        
        .Open Source:="SELECT * from Names" '', Options:=adCmdText
        '' ^
        '' |
        '' +---- Error on this line

    End With
    
End Sub


I'm running Access 6 (11.5614.5606) with VB 6.3


ALL HELP WELCOME!
 
1) You don't need to say where the error is, the error message tells you that.
2) I think you need to add the connection string to the .Open call (.open SQL, ConnectionString)
3) How long have you been coding in ADO? -->
I ask this because normally I use the command object in junction with the recordset.

Example:

Code:
Private Sub Button1_Click()
    Dim cmd As New ADODB.Command
    Dim recset As New ADODB.Recordset
    
    With cmd
        .ActiveConnection = CurrentProject.connection
        .CommandText = "SELECT * from Names" 
    End With
    
    recset.CursorType = adOpenKeyset
    recset.LockType = adLockOptimistic

    set recset = cmd.Execute

    recset.close
    set recset = Nothing
    set cmd = Nothing
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom