(Solved) – VBA: Create new record with current record field value

(solved)-–-vba:-create-new-record-with-current-record-field-value

I want to create a button that will create a new record for data-entry. However, one of the fields in the new record will take a value from a field of the current record. My attempt —

Private Sub NextCondition_Click()
    DoCmd.RunCommand acCmdSaveRecord
    DoCmd.GoToRecord , , acNewRec
    If Me.NewRecord Then
        Me.RespondentID = FormID
    End If
End Sub

FormID is the variable wherein I stored the OpenArgs (which contains the RespondentID). Basically, when this button is clicked, I want the following to happen: save the current record, open a new record, set the respondentID field to the prior records respondentID. However, in my current implementation (i.e. using this code), the new record has a respondentID of 0.

Leave a Reply

Your email address will not be published. Required fields are marked *