Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field UNDO Validation Error

Status
Not open for further replies.
Jan 24, 2002
33
CA
hey guys/gals

I must've used this code 1000 times before and I dont understand where the problem is. Can anyone figure it out?

I have an unbound textbox and I want to make sure that the number is positive. I assign a 1 as default and would like it to revert to that if the number is negative. I really can't see what the problem is.

Private Sub txtSerialMax_BeforeUpdate(Cancel As Integer)

If Me.txtSerialMax <= 0 Then
MsgBox "Invalid Serial No."
Me.txtSerialMax.Undo
Cancel = True
Exit Sub
End If

End Sub

I don't know if it's important but the form is also unbound, popup and opened in Dialog mode.

Help please.
 
what about replacing this:
Me.txtSerialMax.Undo
with this ?
Me!txtSerialMax = 1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for the quick response PHV

I entered a default 1 so that in the case of an Undo, there is already a valid amount. But it can happen that the number is changed by the user to a valid number and then changed again to one that is not.

My main issue is that the Undo doesn't work. It makes no sense. what could make the Undo not function properly?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top