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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Comparison Question

Status
Not open for further replies.

Paul7905

MIS
Jun 29, 2000
205
US
have two combo boxes on a form ~ each displays a row from a table, each row is defined "general" number.

the user is able to select numeric values from each combo box. when the user updates one of them, in the after update event, i evaluate the two combo boxes to ensure that the value in one is less than the value in the other.

this comparison is failing on certain conditions i do not understand.

example:

combo1 has the number 4 in it
combo2 has the number 18 in it

when i compare combo2 to combo1 to see if combo1 is greater than combo2, the compare fails as if the number 4 is greater than the number 18.

my code is as follows:

If (MinSpread.Column(1)) > (MaxSpread.Column(1))Then
(i do a message her if "minspread" is greater than "maxspread")

trouble is, if minspread has 18 in it and maxspread has 4 in it, the compare fails. (it only seems to work if minspread has a single digit number in it or the the two digit number has a value of 40 or greater.)

can someone help me with this sort of comparison logic ? (i have to make sure the number in minspread is less than the number in maxspread)

thanks !

Paul
 
Paul,
You could try using
IF Val(me!minSpread.column(1)) > Val(me!maxSpread.column(1)) > Then...

It looks as though in your example, it's seeing 18 as "18", which is smaller (as text-compare) then "4". The Val() should prevent this. Check the Option Compare statement, if it's Text, this is the cause, in which case you must use the Val(), or, you could explicitly set the Format of the combo box to general number, this should work also.
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top