1

MsgBoxプロンプトでユーザーが「いいえ」を選択した場合、元の値に戻そうとしています。しかし、これは起こっていません。私がどこで間違っているのか見てください。

Private Sub txtNov2_AfterUpdate()
Dim x As Integer
Dim NewValue As Integer
Dim OrigValue As Integer
NewValue = Me.txtNov2.Value
OrigValue = [Forms]![DataEntry]![txtNov2].OldValue 'Me.txtNov2.OldValue
If NewValue <> OrigValue Then
    x = MsgBox("Value Has Changed Do you Want to Update?", vbQuestion + vbYesNo, "Value Change")
    If x = vbYes Then
        MsgBox ("Please Press Update Button")
        btnUpdateData2.SetFocus
    Else
        txtNov2.SetFocus
        'Me.Undo
        txtNov2.Value = OrigValue
        'Cancel = True
    End If
End If
End Sub
4

1 に答える 1