Ok so I've added the proper code to open the recordset and identify the database. My code now looks like this:
Code:
Private Sub btnNewRecord_Click()
Dim BytesRead As Variant, BytesWritten As Variant
Dim Msg As String
Dim T As Recordset
Dim source As String
Dim db As Database
' Open the BLOB table.
Me.AllowAdditions = True
Set db = CurrentDb()
Set T = db.OpenRecordset("REA_BLOB_ATTACHMENTS", dbOpenTable)
T.AddNew
T.Fields("REA_NUM") = Me.Parent.Form.REA_Num
' Move file into record.
source = modBLOB.getOpenFileName()
If source <> "" Then
BytesRead = ReadBLOB(source, T, "Blob")
'Msg = "Finished reading """ & source & """"
'Msg = Msg & Chr$(13) & ".. " & BytesRead & " bytes read."
'MsgBox Msg, 64, "Copy File"
If (BytesRead < 0) Then
MsgBox "Error Saving attachment", vbCritical + vbOKOnly, "Error"
End If
T.Update
Else
T.CancelUpdate
End If
Me.AllowAdditions = False
End Sub
Now I am no longer getting the "No current record" error (Yay!) but I have to click refresh all in the ribbon to see the record in the subform. I'm guessing that's something I can easily call in VBA. Should I also be closing the recordset as well?