Hi,

I'm no expert on the parser, but I think that code is doing this:

If <conditional> Then bgcday = "red" and days0 = days0 + 1 Else
-->
If <conditional> Then bgcday = ("red" and (days0 = (days0 + 1))) Else
-->
If <conditional> Then bgcday = ("red" and False) Else
-->
Type mismatch??

Try using ':' in place of AND.

Eg:

Bgcday = "red" : days0 = days0 + 1

Just as a style issue, and also for readability, try reformatting your
code.  This is what your code actually looks like to the parser:

If Coverday < 0 Then
        bgcday="red"
        days0=days0+1
Else
        If CoverDay > 0 And CoverDay < 45 Then
                bgcday="#2068c0"
                days045=days045+1
        Else
                If CoverDay >= 45 And CoverDay =< 60 Then
                        bgcday="green"
                        days4560=days4560+1
                Else
                        If CoverDay > 60 Then
                                bgcday="yellow"
                                days60=days60+1
                        End If

Which isn't -quite- what I think you're after.

You'd be better of using ElseIf:

If Coverday < 0 Then
        bgcday="red"
        days0=days0+1
ElseIf CoverDay > 0 And CoverDay < 45 Then
        bgcday="#2068c0"
        days045=days045+1
ElseIf CoverDay >= 45 And CoverDay =< 60 Then
        bgcday="green"
        days4560=days4560+1
ElseIf CoverDay > 60 Then
        bgcday="yellow"
        days60=days60+1
End If

Cheerio,
Paul.

-----Original Message-----
From: Van den Bossche Eric [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 2 October 2002 5:10 PM
To: ActiveServerPages
Subject: RE: Lost in Time: If ... then


here is the original code, and it doesnt work:

if Coverday < 0 then bgcday="red" and days0=days0+1 else
if CoverDay > 0 and CoverDay < 45 then bgcday="#2068c0" and
days045=days045+1 else 
if CoverDay >= 45 and CoverDay =< 60 then bgcday="green" and
days4560=days4560+1 else 
if CoverDay > 60 then bgcday="yellow" and days60=days60+1 end if

any suggestion

-----Original Message-----
From: Josh G [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 02 October, 2002 9:02
To: ActiveServerPages
Subject: Re: Lost in Time: If ... then


If you say so. But one-line if statements don't need "end if" at the
end, and I still say you've got problems with a loop / conditional
somewhere else in your code.

-Josh
--
And can you tell me doctor why I still can't get to sleep?
And why the channel 7 chopper chills me to my feet?
And what's this rash that comes and goes, can you tell me what it means?
God help me, I was only 19


----- Original Message -----
From: "Van den Bossche Eric" <[EMAIL PROTECTED]>
To: "ActiveServerPages" <[EMAIL PROTECTED]>
Sent: Wednesday, October 02, 2002 5:01 PM
Subject: RE: Lost in Time: If ... then


> Dude, don't think so.
>
> if x < 0 then
>      a = "green"
>      z=z+1
> end if
>
> gives me an error "unexpected next" way above these lines.
>
> If i use
>
> if x < 0 then a = "green" end if
>
> then everything is working fine.
>
> Eric
>
> -----Original Message-----
> From: Josh G [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 02 October, 2002 8:54
> To: ActiveServerPages
> Subject: Re: Lost in Time: If ... then
>
>
> Dude, if my solution doesn't work, you have errors elsewhere in your 
> code
> ;-)
>
> -Josh
> --
> And can you tell me doctor why I still can't get to sleep? And why the

> channel 7 chopper chills me to my feet? And what's this rash that 
> comes and goes, can you tell me what it means? God help me, I was only

> 19
>
>
> ----- Original Message -----
> From: "Van den Bossche Eric" <[EMAIL PROTECTED]>
> To: "ActiveServerPages" <[EMAIL PROTECTED]>
> Sent: Wednesday, October 02, 2002 4:55 PM
> Subject: RE: Lost in Time: If ... then
>
>
> > Sorry guys,
> >
> > but neither of your 2 sollutions work, AND gives me expected end of 
> > statement errors, and Josh sollution give me errors somewhere else 
> > in my code. Could Select Case be my sollution ?
> >
> > Thanks - Eric
> >
> > -----Original Message-----
> > From: Josh G [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, 02 October, 2002 8:47
> > To: ActiveServerPages
> > Subject: Re: Lost in Time: If ... then
> >
> >
> > AND? I didn't know that was an option. Anyway, it's a bad idea, it 
> > makes your code hard to read. If I see an AND in an if statement and

> > it
doesn't
> do
> > what I expect it to (ie IF foo AND bar THEN...) it makes my life 
> > hard.
The
> > best way for readability would be:
> >
> > if x < 0 then
> >     a = "green"
> >     z=z+1
> > end if
> >
> > It gets the desired results, and the indenting makes things easier 
> > to follow.
> >
> > On a slightly related note, does "foo=bar : z=z=+1" work? It was a
> technique
> > used to squeeze things on to one line in the golden days of basic :)
> >
> > -Josh
> > --
> > And can you tell me doctor why I still can't get to sleep? And why 
> > the channel 7 chopper chills me to my feet? And what's this rash 
> > that comes and goes, can you tell me what it means? God help me, I 
> > was only 19
> >
> >
> > ----- Original Message -----
> > From: "Tsiris Alexandros" <[EMAIL PROTECTED]>
> > To: "ActiveServerPages" <[EMAIL PROTECTED]>
> > Sent: Wednesday, October 02, 2002 4:35 PM
> > Subject: RE: Lost in Time: If ... then
> >
> >
> > >
> > >
> > >
> > > > Hi guys,
> > > >
> > > > i feel foolish now:
> > > >
> > > > I want to do more than 1 opperation in an if...then statement, 
> > > > for ex.: if x < 0 then a = "green", z=z+1 end if
> > > >
> > > > this fails on the , (expected end of statement)
> > > >
> > > > Any idea how i can get this to work?
> > >
> > > use AND
> > > then a="green" and z=z+1
> > >
> > >
> > > Alexander
> > >
> > > ---
> > > You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
> > > To unsubscribe send a blank email to
> > %%email.unsub%%
> > >
> >
> >
> > ---
> > You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
> > To unsubscribe send a blank email to
> > %%email.unsub%%
> >
> > ---
> > You are currently subscribed to activeserverpages as: 
> > [EMAIL PROTECTED] To unsubscribe send a blank email to
> %%email.unsub%%
> >
>
>
> ---
> You are currently subscribed to activeserverpages as: 
> [EMAIL PROTECTED] To unsubscribe send a blank email to 
> %%email.unsub%%
>
> ---
> You are currently subscribed to activeserverpages as: 
> [EMAIL PROTECTED] To unsubscribe send a blank email to
%%email.unsub%%
>


---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED] To unsubscribe send a blank email to %%email.unsub%%

---
You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%

---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to