I have a form where I ask the user to attach a file then press the Save button to save the attached file in the record along with the other entered data.
I managed to have the file picked but I need to save it in my table and I prefer to do it programmatically using VB.
The following code helped me with fetching the file and store it in a specific path on my computer but again that's not the case.
On Error GoTo Err_SaveImage
Dim db As DAO.Database
Dim rsParent As DAO.Recordset2
Dim rsChild As DAO.Recordset2
Set db = CurrentDb
Set rsParent = Me.Recordset
rsParent.OpenRecordset
Set rsChild = rsParent.Fields("Attach").Value
rsChild.OpenRecordset
rsChild.Fields("FileData").SaveToFile ("C:\")
Exit_SaveImage:
Set rsChild = Nothing
Set rsParent = Nothing
Exit Sub
Err_SaveImage:
If Err = 3839 Then
MsgBox ("File Already Exists in the Directory!")
Resume Next
Else
MsgBox "Some Other Error occured!", Err.Number, Err.Description
Resume Exit_SaveImage
End If
Maybe that can give you a head-start.