Tom, > It seems that mytime is assigned the value in the if statement.
That is exactly what is happening. '=' is the assignment operator. You need '==' for the conditional (ie. comparison) operator. Regarding the first part, where you say you get either zero or 142059, where are you seeing those values? TimeNum returns an array. Is the whole array full of those values, and is it 142059 every time you call TimeNum? Regards, GP --- In [email protected], "professor77747" <[EMAIL PROTECTED]> wrote: > > If I want to assign the current time to a variable, how do I do it? I > have tried this > > myhours=TimeNum(); > > > However, I will get either a value of 0 or I get 142059. I don't > understand why I would get two different values especially when both > of them are wrong. > > Also,when I use this if statement, I get the value for mytime as 800 > which then assigns Conditon201 a value of 100. > > mytime= IIf (myhours >=153000 AND myhours <=163100,200,100); > > if (mytime =800 ) > > Condition201=200; > else > { > Condition201=100; > } > > If I change it to this, > > mytime= IIf (myhours >=153000 AND myhours <=163100,2300,100); > if (mytime =200 ) > > Condition201=200; > else > { > Condition201=100; > } > > it then assigns Condition201 a value of 200 even when the time is not > correct and mytime should be 100. It seems that mytime is assigned > the value in the if statement. > > What am I doing wrong? > > Thanks, > Tom >
