patriciaxxx
Programmer
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
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