Here is the revised example app. The Q&A editor does not appear to allow an attachment to be replaced...only deleted.
The ue_ProcessEnter event script:
// ue_ProcessEnter event (mapped to pbm_dwnprocessenter)
// PB triggers this DW event when a column has input focus and the Enter key has been pressed.
// This script triggers the ButtonClicked event for a button DWObject when Enter is pressed.
Long ll_row, ll_action
String ls_button_name
DWObject ldwo
// In order to trigger the ButtonClicked event for a button DWObject,
// you must supply three argument values:
// 1. The row number (long).
// 2. A code designating the action to be taken when the button is clicked (long).
// Refer to this property of the button DWObject in the DataWindow Painter for
// more information on the possible values of this code.
// 3. A reference to the button DWObject that has been clicked.
ll_row = This.GetRow()
If ll_row < 1 Or ll_row > This.RowCount() Then Return 0
ll_action = 0 // 0 => User Defined action
// If you can hard-code the name of the button DWObject, you can obtain a reference
// to it via dot notation. In this example, the button DWObject's name is "b_click_me".
ldwo = This.Object.b_click_me
// If you cannot hard-code the name of the button DWObject, you can dynamically obtain
// a reference to it via the undocumented __get_attribute method, as shown below:
//ls_button_name = "b_click_me" // ...for example
//ldwo = This.Object.__get_attribute(ls_button_name,False)
// Trigger the ButtonClicked event, but only if we have a valid DWObject reference.
If IsValid(ldwo) Then
This.Event ButtonClicked(ll_row,ll_action,ldwo)
// If desired, post a call to the SetRow() method to keep the same current row
// after the Enter key is pressed, as shown below.
This.Post Function SetRow(ll_row)
End If
Return 0