Forums
This topic is locked
Select Case Help
Posted 02 Oct 2002 21:16:01
1
has voted
02 Oct 2002 21:16:01 Dave Thomas posted:
I'm trying to colour the background of a table cell depending on the result of our Counterstrike clan based on a recordset.I Tried first with the Select Case example, here was my code:
<%
myResult = rsClanA.fields.item("Result".value
Select Case myResult
Case "Win"
tdcolour="#00FF00"
Case "Draw"
tdcolor = "#FFFF00"
Case "Lose"
tdcolor ="#FF0000"
End Select
%>
Then
bgcolor=" <%= tdcolor %> " in my TD tag
it colours the cell but only with the Win color "green", I've tried placing the code in the Repeat Region, Head, and Table Cell but with no joy.
I also tried it using the IF statement, again this coloured the cell but only with Green. This is the final pice of the jigsaw for a certain part of the site and I really wanna sort it
I can send anyone the page if they would like to look at the source.
Please any ideas anyone where I am going wrong?
Regards,
Dave
UD4 || Flash || Access ||Web Hosting
Replies
Replied 03 Oct 2002 09:41:32
03 Oct 2002 09:41:32 Vince Baker replied:
The problem could be that when you are defining the variable (dim) you are doing this outside of the repeat region.
The whole code needs to be inside the repeat region.
Regards
Vince
Response.write("The best line of code you can ever use"
VBScript | ASP | HTML | SQL | Oracle | Hosting
The whole code needs to be inside the repeat region.
Regards
Vince
Response.write("The best line of code you can ever use"
VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 03 Oct 2002 12:51:03
03 Oct 2002 12:51:03 Dave Thomas replied:
It already is inside the repeat region m8 <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
The page is here: www.nova-cs.co.uk/version2/clan_results.asp
Regards,
Dave
UD4 || Flash || Access ||Web Hosting
The page is here: www.nova-cs.co.uk/version2/clan_results.asp
Regards,
Dave
UD4 || Flash || Access ||Web Hosting
Replied 03 Oct 2002 16:41:36
03 Oct 2002 16:41:36 Stuart Harland replied:
Well if the select case is working for the 'win'/green parts then your case is working properly.
The only thing I could suggest is that you check your data base entries for 'Draw' and 'Lose' because for some reason it's not finding these. Instead of declaring a variable just select the record item as the case:
<b>Select Case rsClanA.fields.item("Result".value</b>
And also check your spelling of your variables, because you put color/ colour sometimes and might have done this in the code somewhere.
********************
wheatNOTmeat
The only thing I could suggest is that you check your data base entries for 'Draw' and 'Lose' because for some reason it's not finding these. Instead of declaring a variable just select the record item as the case:
<b>Select Case rsClanA.fields.item("Result".value</b>
And also check your spelling of your variables, because you put color/ colour sometimes and might have done this in the code somewhere.
********************
wheatNOTmeat
Replied 04 Oct 2002 01:11:17
04 Oct 2002 01:11:17 Dave Thomas replied:
Well ferox u were right, silly me <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
It was all down to a letter "l" in my Lose condition not being capitalised.
<b>Woohoo, page now in full working order</b> <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Oh BTW: Colour = Coz i'm english, + Color = Coz the yanks just had to be awkward <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Regards,
Dave
UD4 || Flash || Access ||Web Hosting
It was all down to a letter "l" in my Lose condition not being capitalised.
<b>Woohoo, page now in full working order</b> <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Oh BTW: Colour = Coz i'm english, + Color = Coz the yanks just had to be awkward <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Regards,
Dave
UD4 || Flash || Access ||Web Hosting