Hi,
I would appreciate some help please. I have created a form to add new records. I'm using the following code to update the recordset. It works when I have one attachment but causes an error if there's more then one. After the update, I need to set the attachment field to null to add another new record. I would be very grateful for an example of the code I should use in your response please as I am new to this.
Also, when I click on the btnSaveNew, how do I advance the ClientActivityID to a new record please.
Private Sub btnSaveNew_Click()
Dim ClientActivities As DAO.Recordset
Set ClientActivities = CurrentDb.OpenRecordset("SELECT * FROM [ClientActivities]")
ClientActivities.AddNew
ClientActivities![ClientId] = Me.ClientId.Value
ClientActivities![ClientActivityId] = Me.ClientActivityId.Value
ClientActivities![CreatedDate] = Me.CreatedDate.Value
ClientActivities![Activity] = Me.Activity.Value
ClientActivities![Priority] = Me.Priority.Value
ClientActivities![AssignedTo] = Me.AssignedTo.Value
ClientActivities![AppointmentDate] = Me.AppointmentDate.Value
ClientActivities![StartTime] = Me.StartTime.Value
ClientActivities![EndTime] = Me.EndTime.Value
ClientActivities![Details] = Me.Details.Value
ClientActivities![ActivityStatus] = Me.ActivityStatus.Value
ClientActivities![Note] = Me.Note.Value
ClientActivities![Note] = Me.Attachment.AttachmentCount
ClientActivities.Update
ClientActivities.Close
Set ClientActivities = Nothing
Me.ClientId.Value = Null
Me.CreatedDate.Value = Null
Me.CreatedBy.Value = Null
Me.Activity.Value = Null
Me.Priority.Value = Null
Me.AssignedTo.Value = Null
Me.AppointmentDate.Value = Null
Me.StartTime.Value = Null
Me.EndTime.Value = Null
Me.Details.Value = Null
Me.ActivityStatus.Value = Null
Me.Note.Value = Null
End Sub
Thank you,
Tess