Forum Moderators: open

Message Too Old, No Replies

IF varQ < varGRR THEN

i'm stuck too long on this one...any help out there?

         

dohs

9:34 pm on Jan 7, 2005 (gmt 0)

10+ Year Member



below is a piece of my code for a survey app i'm writing with some lines added/changed for testing purposes. i have a counter named varQ. i'm trying to use a simple IF THEN ELSE END IF statement. as long as varQ is below my target count i want to add one to the count varQ and submit the data. when i reach my target count i want to finish by passing other data and finish.

i can't get the IF THEN statement to work. i am testing the variables as you see at the top of my code and i show you the results. varQ is 1 and varGRR is 2. if i replace one variable name with a number the statement returns correctly, but using both the variables "If varQ < varGRR Then" it does not work. what am i missing? thanks much everybody!

Response.Write varQ & "<Br>"
Response.Write oRS3("questions")& "<Br>"
Dim varGRR
varGRR = oRS3("questions")
Response.Write varGRR & "<Br>"

DimTest = varQ < varGRR
Response.Write DimTest & "<Br>"
DimTest2 = varQ < 2
Response.Write DimTest2 & "<Br>"
DimTest3 = 1 < varGRR
Response.Write DimTest3 & "<Br>"

*********************test results produced********************
1
2
2
False
True
True
******************end test results********************

If varQ < varGRR Then

varQ = varQ + 1
Response.Write "<INPUT TYPE='HIDDEN' NAME='Q' VALUE='" & varQ & "'>"
Response.Write "<p>&nbsp;</p><p><input type='submit' value=" & varQ & " name='submit'></p>"

Else

Response.Write "<INPUT TYPE='HIDDEN' NAME='Q' VALUE='F'>"
Response.Write "<p>&nbsp;</p><p><input type='submit' value='Finish' name='submit'></p>"
End If

wackal

10:37 pm on Jan 7, 2005 (gmt 0)

10+ Year Member



try this:

replace

If varQ < varGRR Then

with

If Int(varQ) < Int(varGRR) Then

dohs

11:00 pm on Jan 7, 2005 (gmt 0)

10+ Year Member



thanks wackal, that did the trick! i tried playing with the Int function earlier for a bit but i must have been concentrating on only one of the variables at that point and probably did not get the Int around both of them. thanks a bunch for the help. i may get this survey done some time after all!

wackal

11:12 pm on Jan 7, 2005 (gmt 0)

10+ Year Member



glad to hear it!