The following is a part of my validation on the BeforeUpdate event procedure
of an unbound text box (Me!PndCk18In1) on my form. My issue is that although
it captures and prompts the "error" this line (Me!PndCk18In1.Undo '**ISSUE**)
does not seem to work therefore after the prompt it still places that value
in that text box. I have used this approach on bound text boxes with no
issues so I'm not sure what's going wrong with the unbound text
boxes...please help.
'Check for Project start time
If IsNull(Me!In.Value) Then
Cancel = True
MsgBox "Missing [TIME: In]. Project has not begun.",
vbExclamation, "TIME ERROR"
Me!PndCk18In1.Undo '**ISSUE**
Exit Sub
End If
Thank you in advance for you assistance.
Marshall Barton - 04 Feb 2006 20:37 GMT
>The following is a part of my validation on the BeforeUpdate event procedure
>of an unbound text box (Me!PndCk18In1) on my form. My issue is that although
[quoted text clipped - 12 lines]
> Exit Sub
> End If
The Undo method (and the OldValue property) only operate on
bound controls.
To capture the value before it is edited, use the control's
Enter event to save its value to a module level variable.
Then you can restore the value from the variable.

Signature
Marsh
MVP [MS Access]
AccessARS - 05 Feb 2006 08:31 GMT
Thank you.
> >The following is a part of my validation on the BeforeUpdate event procedure
> >of an unbound text box (Me!PndCk18In1) on my form. My issue is that although
[quoted text clipped - 19 lines]
> Enter event to save its value to a module level variable.
> Then you can restore the value from the variable.