hi all,
I would like to insert an attachment object into a table using a form. I have created a table with a field type attachment. But when i am inserting data into table , error is coming.
The error is:
Runtime error: -2147217887
Cannot perform this operation.
Purchase_PRnote is the name of the textbox which contains the attachment.
I would like to insert an attachment object into a table using a form. I have created a table with a field type attachment. But when i am inserting data into table , error is coming.
The error is:
Runtime error: -2147217887
Cannot perform this operation.
Code:
Private Sub cmd_add_save_Click()
Dim cmd As ADODB.Command, rs As ADODB.Recordset
Set cmd = New ADODB.Command
cmd.ActiveConnection = CurrentProject.AccessConnection
cmd.CommandType = adCmdUnknown
Set rs = New ADODB.Recordset
rs.Open "Purchase", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
With rs
.AddNew ' create a new record
.Fields(0) = Me.txt_add_prno
.Fields(1) = Me.txt_add_prdesc
.Fields(2) = Me.txt_add_prvalue
.Fields(3) = Me.txt_pr_date
.Fields(4) = Me.Purchase_PRNote ' Error occurs at this line.
.Update
End With
Set rs = Nothing
End Sub
Comment