Validation Code Textbox.Value vs. Number

fegarci

New member
Local time
, 17:55
Joined
Mar 4, 2013
Messages
4
I have the following code to validate that the value entered in a text box is less than the amount in another text box:


Private Sub TxtPaymentAmount_AfterUpdate()
Dim LResponse As Integer

If TxtPaymentAmount.Value > TxtPOTotal.Value Then

LResponse = MsgBox("Payment Amount is greater then PO Invoice Amount", vbOKOnly, "Input Error")
TxtPaymentAmount.Value = 0
TxtPaymentAmount.SetFocus
End If

End Sub

I am assigning the value in TxtPOTotal using the following code:

Private Sub ComboPONumber_AfterUpdate()

Let TxtPOTotal.Value = Format(ComboPONumber.Column(3), "0,000.00")


End Sub



Apparently the value in fisrt text box is a stored as value but the second text box is stored as a string, so the condition never a applies. Any ideas?

:banghead:
 
Also check out the other Data Type conversion functions here
 
It worked, I also needed a good source for text conversion function. Thank you!!!
 
CDbl might be better if you concerned about exact money amounts

David
 

Users who are viewing this thread

Back
Top Bottom