fredzeppelin
Technical User
I have a text box, which I want to allow changes, but with a strong warning to be sure. Proc tied to BeforeUpdate event:
Stolen straight from the Access doc's/examples.
If I click OK, the textbox stays changed, and the cursor moves on to whatever I did to trigger the control update (eg TAB).
If I click Cancel the Text in the TexBox is selected (highlighted)and the cursor is positioned at chr(0).
I'd hoped that the text would be returned to its pre-edit state and the cursor would do something useful and predicatable based on the update triggering event.
I'm not sure I understand what Cancel and Undo do in this context, and if there's any interaction between them.
I searched the fora and faq's, didn't see anything. If one exists, just point.
(I assume that a Boolean type is just an Integer which is only permitted two values;
0 and -1 ?
Cancel as Integer = True ' hmmmmmmm?
Then the real propellor heads can play all those bit-manipulation games )
Thanks
Stolen straight from the Access doc's/examples.
Code:
Private Sub Text39_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
strMsg = "Don't Do It !"
If MsgBox(strMsg, vbExclamation + vbOKCancel, "Are You Sure?") = vbOK Then
Cancel = False
Else
Cancel = True
Me!Text39.Undo
End If
If I click OK, the textbox stays changed, and the cursor moves on to whatever I did to trigger the control update (eg TAB).
If I click Cancel the Text in the TexBox is selected (highlighted)and the cursor is positioned at chr(0).
I'd hoped that the text would be returned to its pre-edit state and the cursor would do something useful and predicatable based on the update triggering event.
I'm not sure I understand what Cancel and Undo do in this context, and if there's any interaction between them.
I searched the fora and faq's, didn't see anything. If one exists, just point.
(I assume that a Boolean type is just an Integer which is only permitted two values;
0 and -1 ?
Cancel as Integer = True ' hmmmmmmm?
Then the real propellor heads can play all those bit-manipulation games )
Thanks