Click to See Complete Forum and Search --> : Problem with a simple If condition...


weee
06-08-2004, 05:54 PM
Hi There.

I have a databse of stores that contain the number of products the stores can advertise. I'm trying to compare to number of products the store can advertise with the number of the products the store already advertise. I manage to get those numbers.

The problem is that I'm trying to compare between the number but it won't work. code:


If productsNumberOnLine = productsNumber Then


It seems like the If doesn't do nothing!
I changed the productsNumber to th actual number "5" and it worked good.
I check if the Varialbes contain any number and they do contain the right numbers.

What can it be?

Thanks!

lmf232s
06-08-2004, 07:56 PM
weee do me a favor and right before your if statement put this

Response.write "productsNumberOnLine(" & productsNumberOnline & ") = productsNumber(" & productsNumberOnline & ")"

and tell me what is says

weee
06-09-2004, 12:51 PM
numOfProductsOnLine(5) = numOfProducts(5)

lmf232s
06-09-2004, 01:34 PM
weee,
It might be because one variable is a string and the other is a numeric.

If they are always going to be whole numbers, You might try something like
if cint(youvariable) = cint(yourvariable) then

or

if cdbl(yourvariable) = cdbl(yourvariable) then

Maybe.

weee
06-09-2004, 01:38 PM
it's working! thank you so much!