Compare the "varchar" values

T

Tim

I need to compare the student's score with the requirement score. The problem
is the score is either a varchar value, i.e., "2" OR is combined by two
varchar values, such as "2" and "+" or "-" like "2+". If a student's score is
lower then the req score then the student is not qualified. How to compare
them in VBA?
Thank you in advance for your help.
 
J

John Spencer

I would force the values to increase or decrease based on the presence of the
+ and - signs and then compare the numeric values. Using Replace and Eval you
could use an expression like the following for the comparison.

Eval(Replace(Replace(Score,"+","+.1"),"-","-.1")) >=
Eval(Replace(Replace(Required,"+","+.1"),"-","-.1"))

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top