Hello,
I use the following code to add a new record line and populate it with values.
The problem is, I can’t find this new record again on the form after I filter the form. Even after I remove the filter to show all records, this new record doesn’t show up on the form.
However, when I open the table that serves as the record source I can see the record is in the table.
Could someone suggest how to fix this problem?
Thanks
I use the following code to add a new record line and populate it with values.
Code:
Dim str_sampleid As String
If Me.cmb_samples.Column(0) = "(All)" Then
MsgBox "Select sample to add new record"
Exit Sub
End If
Application.Echo False
Me.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
'populate fields with data
str_sampleid = Me.cmb_samples.Column(3) & "_" & Me.cmb_samples.Column(0)
Debug.Print str_sampleid
Me.sample_id = str_sampleid
Me.sample_name = Me.cmb_samples.Column(0)
Me.tumor_type = Me.cmb_samples.Column(1)
Me.AllowAdditions = False
Application.Echo True
DoCmd.RunCommand acCmdSaveRecord
However, when I open the table that serves as the record source I can see the record is in the table.
Could someone suggest how to fix this problem?
Thanks