Not sure how well I followed the description, but it seems you might take advantage of the OpenArgs
parameter with OpenForm
. (Your existing code uses the WhereCondition
parameter, but that is meaningless for an unbound form.)
OpenArgs
is the seventh parameter to OpenForm
. If I counted commas correctly, this could work:
DoCmd.OpenForm "Add Item to RMA", , , , , , Me!RMANbr
However, I would use the option's name to avoid counting commas.
DoCmd.OpenForm "Add Item to RMA", OpenArgs:=Me!RMANbr
Then in the target form's load event, you can move to the new record and use the OpenArgs
value in the text box which holds RMANbr
(I guessed the text box name is txtRMANbr).
Private Sub Form_Load()
DoCmd.GoToRecord acDataForm, , acNewRec
If Not IsNull(Me.OpenArgs) Then
Me.txtRMANbr = Me.OpenArgs
End If
End Sub