1
如果在MsgBox
提示下用戶選擇「否」,我試圖恢復到原始值。但是,這沒有發生。你能看看我哪裏去錯了嗎?確認提示在Access窗體上更改值
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
感謝您的反饋和Gord,只有現在的問題是當我用DoCmd.RunCommand運行它acCmdUndo它給我一個運行時錯誤2046 >>'命令或行動'撤消'現在不可用'... – user1775842
@ user1775842我不知道,它適用於我,但後來我表單非常簡單(一個文本框和一個「更新」按鈕,實際上並沒有做任何事情)。你的表單是綁定到一個表/查詢,並且是'txtNov2'綁定到一個字段? (這是我使用的設置。) –
是的,這是...我會chk,看看我是否禁用窗體控件上的東西...嘆氣.... thx再次爲您的提示 – user1775842