Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Methode open of object recorset failed

Status
Not open for further replies.

patriciaxxx

Programmer
Joined
Jan 30, 2012
Messages
277
Location
GB
Below is my code I just can’t get the following line coded properly
strSQL = "SELECT * FROM tblBlob WHERE Write = True"
The field Write is a Yes/No field

Private Sub cmdExtract_Click()
On Error GoTo Err_Handler
Dim strSQL As String
Dim rst As Object 'ADODB.Recordset
Dim strFile As String

Set rst = CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM tblBlob WHERE Write = True"
rst.Open strSQL, CurrentProject.Connection, 1, 3
Do Until rst.EOF
If Not IsNull(rst!FileExt) Then
strFile = CurrentProject.Path & "\files\" & rst!FileName & "." & rst!FileExt
End If
WriteBinaryFile rst.Fields("BLOB").Value, strFile
rst.MoveNext
Loop
MsgBox rst.RecordCount & " records have been extracted."

Exit_Handler:
rst.Close
Set rst = Nothing
Exit Sub

Err_Handler:
MsgBox Err.Description, vbOKOnly + vbExclamation, "ERROR: " & Err.Number
Resume Exit_Handler

End Sub
 
What exactly appears to be the problem?
 
Write" is a reserved word in JET 4.0. Try
Code:
strSQL = "SELECT * FROM tblBlob WHERE [b][red][[/red][/b]Write[b][red]][/red][/b] = True"
 
Too slow golom. Already answered in Patriociaxxx's thread705-1696862 ;-)

Patriciaxxx, you might want to keep a single problem in a single thread.
 
strongm said:
Too slow golom.

With your encyclopedic knowledge on the scene, that's not exactly unusual for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top