![]() |
| |||||||
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
| |||
| If problem -------------------------------------------------------------------------------- Hi, I have 3 variables which store values like this lunch="1" dinner="2" snacks="3" if lunch is selected then the value is 1 if not its blank if dinner is selected then the value is 2 if not its blank if snacks is selected then the value is 3 if not its blank If all 3 are selected the price is $12 if 2 of them is selected the price is $8 if one of them is selected the price is $5 so here is the code Code: If lunch="1" And dinner="2" And snacks="3" Then finaltotal="12" End If If (lunch="1" And dinner="2") or (lunch="1" And snacks="3") Or (dinner="2" And snacks="3") Then finaltotal="8" End If If (lunch="1") Or (dinner="2") Or (snacks="3") Then finaltotal="5" End If todd |
| Sponsored Links |
| ||||
| need to use ElseIfs ... the way you have it now, is that you're going to go through each if/then statement ... hence you could change your variable value. try something like this: Code: If lunch="1" And dinner="2" And snacks="3" Then
finaltotal="12"
ElseIf (lunch="1" And dinner="2") or (lunch="1" And snacks="3") Or (dinner="2" And snacks="3") Then
finaltotal="8"
ElseIf (lunch="1") Or (dinner="2") Or (snacks="3") Then
finaltotal="5"
End If
__________________ Quote of the Month: Strife: As long as we have each other, we'll never run out of problems. Questions to Ponder: Should vegetarians eat animal crackers? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright © 2008 sbenj69 |
| ||||
| Due to inactivity of 14 days, this thread is deemed abandoned and is now closed. If this thread was marked as "Solved", the orginal poster may mark it as "Unsolved" via the Thread Tools menu, thus re-opening the thread. If this thread was not marked as "Solved", the original poster may re-open the thread via the Thread Tools menu. Regards, richyrich DeveloperBarn Forums Moderator |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
| Sponsored Links |
| ASP.NET Resource Index a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer. Free Web Directory Including Chats and Forums Resources, Offer automatic, instant and free directory submissions. | URLZ Web Directory URLZ Web Directory Free Web Directory - Add Your Link The Little Web Directory | Free Web Directory Pegasus free web directory is a free directory organised by categories. Web Directory & SEO Services dirroot web directory |