
Updating subform to new record not overwriting old record
To do this, you need to move the focus of the subform to a new record.
Try this:
me.frm_Talk_Date_History.setfocus
DoCmd.GoToRecord , , acNewRec
with me.frm_Talk_Date_History.form
![Talk History] = [PT Date]
![Talk #] = [Talk Number]
end with
Another method is to use the subform's recordsetclone
with with me.frm_Talk_Date_History.form.recordsetclone
.addnew
![Talk History] = [PT Date]
![Talk #] = [Talk Number]
.update
end with
--
Sandra Daigle, Microsoft Access MVP
Quote:
> I have a field on the main form that when selected should add a new
record
> to the subform to reflect a history of the event.
> My problem is that rather then adding a new record on the subform it
> overwrites the existing record.
> How can I force a new record?
> The subform is updated from data on the main form. The subform is
used to
> keep a history of the event. Rather then having the user enter the
data I
> want this to happen automatically.
> Here is the code for the event. Can anyone help?
> Lou
> Private Sub Talk_Number_Exit(Cancel As Integer)
> 'If the speaker is incoming then the talk history date and talk
number
> 'is automatically filled in with the data from PT Date and Talk
Number
> If [Incoming/Outgoing] = "Incoming" Then
> frm_Talk_Date_History![Talk History] = [PT Date]
> frm_Talk_Date_History![Talk #] = [Talk Number]
> Else
> End If
> End Sub