Earl C Phillips
Volunteer Programmer
- Local time
- Today, 07:07
- Joined
- Jul 18, 2008
- Messages
- 40
I was getting inconsistent results using Me.Undo to prevent updating a record except when intended using the "Add Record" button. I corrected that based upon the responce I received which stated that Me.Undo needed to be in an event that was cancelable.
I inserted a public flag, set the flag as true when pressing a "Return to Main" button, and wrote:
if flag = true then
me.undo
cancel = true
flag = false
goto Exit_cancelablesub_BeforeUpdate
end if
I also wrote:
Private Sub Form_KeyPress(KeyAscii As Integer)
If (KeyAscii=vbKeyReturn) Or (KeyAscii = vbKeyF5) Or _
(keyAscii = vbkeyF9) Then
KeyAscii = 0
End If
Exit_Form_KeyPress:
Exit Sub
It still creates a record when I press F5 or F9. Why?
I inserted a public flag, set the flag as true when pressing a "Return to Main" button, and wrote:
if flag = true then
me.undo
cancel = true
flag = false
goto Exit_cancelablesub_BeforeUpdate
end if
I also wrote:
Private Sub Form_KeyPress(KeyAscii As Integer)
If (KeyAscii=vbKeyReturn) Or (KeyAscii = vbKeyF5) Or _
(keyAscii = vbkeyF9) Then
KeyAscii = 0
End If
Exit_Form_KeyPress:
Exit Sub
It still creates a record when I press F5 or F9. Why?
Last edited: