If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
If Statement with And and Or
I wrote the following calculation on a form and it does work, however, I know
that it can be combined. I have been trying, but no matter how I combine them I keep getting errors. Here is what I have without combining the last two IIfs. =IIf(([txtBannerType]="Standard" And [txtPaperType]="Large Format Bright White (#24)"),[lngCount]*5,IIf(([txtBannerType]="Customized" And [txtPaperType]="Large Format Bright White (#24)"),([lngCount]*[lngFeet])*1,IIf(([txtBannerType]="Standard" And [txtPaperType]="Standard White Continuous"),[lngCount]*5,IIf(([txtBannerType]="Customized" And [txtPaperType]="Standard White Continuous"),([lngCount]*[lngFeet])*1)))) I just need to say the [txtPaperType] can be Large Format... or Standard White... but I'm a beginner and I can't get it right. Can anyone help me? Thanks in advance. |
#2
|
|||
|
|||
If Statement with And and Or
I just need to say the [txtPaperType] can be Large Format... or Standard
White... Your IIF statements are testing for "Standard" and "Large Format Bright White (#24)" and if true then display [lngCount]*5 which would be a number, not a paper discription. You also have syntax errors that are corrected below -- =IIf(([txtBannerType]="Standard" And [txtPaperType]="Large Format Bright White (#24)", [lngCount]*5, IIf(([txtBannerType]="Customized" And [txtPaperType]="Large Format Bright White (#24)", ([lngCount]*[lngFeet])*1, IIf(([txtBannerType]="Standard" And [txtPaperType]="Standard White Continuous"), [lngCount]*5, IIF([txtBannerType]="Customized" And [txtPaperType]="Standard White Continuous", [lngCount]*[lngFeet]*1)))) Your last test has [lngCount]*[lngFeet]*1 for true results but no false results is entered. False would be like this ... [lngCount]*[lngFeet]*1, "Something is wrong here")))) -- Build a little, test a little. "Ann" wrote: I wrote the following calculation on a form and it does work, however, I know that it can be combined. I have been trying, but no matter how I combine them I keep getting errors. Here is what I have without combining the last two IIfs. =IIf(([txtBannerType]="Standard" And [txtPaperType]="Large Format Bright White (#24)"),[lngCount]*5,IIf(([txtBannerType]="Customized" And [txtPaperType]="Large Format Bright White (#24)"),([lngCount]*[lngFeet])*1,IIf(([txtBannerType]="Standard" And [txtPaperType]="Standard White Continuous"),[lngCount]*5,IIf(([txtBannerType]="Customized" And [txtPaperType]="Standard White Continuous"),([lngCount]*[lngFeet])*1)))) I just need to say the [txtPaperType] can be Large Format... or Standard White... but I'm a beginner and I can't get it right. Can anyone help me? Thanks in advance. |
#3
|
|||
|
|||
If Statement with And and Or
Your IIF statements are testing for "Standard" and "Large Format Bright
White (#24)" and if true then display [lngCount]*5 which would be a number, not a paper discription. Yes that is true...it's a number. Depending on the criteria for txtPaperType and txtBannerType will depend on how much I charge for a banner. I'm trying to combine them because the Standard for txtBannerType and Large Format... or Standard White for txtPaper Type are the same fee, $5 per banner. And the Customized for txtBannerType and Large Format...or Standard White for txtPaperType is $1 per foot per banner so I don't need these to be separate. Right now I have four if statements and I want to combine them into two statements. "KARL DEWEY" wrote: I just need to say the [txtPaperType] can be Large Format... or Standard White... Your IIF statements are testing for "Standard" and "Large Format Bright White (#24)" and if true then display [lngCount]*5 which would be a number, not a paper discription. You also have syntax errors that are corrected below -- =IIf(([txtBannerType]="Standard" And [txtPaperType]="Large Format Bright White (#24)", [lngCount]*5, IIf(([txtBannerType]="Customized" And [txtPaperType]="Large Format Bright White (#24)", ([lngCount]*[lngFeet])*1, IIf(([txtBannerType]="Standard" And [txtPaperType]="Standard White Continuous"), [lngCount]*5, IIF([txtBannerType]="Customized" And [txtPaperType]="Standard White Continuous", [lngCount]*[lngFeet]*1)))) Your last test has [lngCount]*[lngFeet]*1 for true results but no false results is entered. False would be like this ... [lngCount]*[lngFeet]*1, "Something is wrong here")))) -- Build a little, test a little. "Ann" wrote: I wrote the following calculation on a form and it does work, however, I know that it can be combined. I have been trying, but no matter how I combine them I keep getting errors. Here is what I have without combining the last two IIfs. =IIf(([txtBannerType]="Standard" And [txtPaperType]="Large Format Bright White (#24)"),[lngCount]*5,IIf(([txtBannerType]="Customized" And [txtPaperType]="Large Format Bright White (#24)"),([lngCount]*[lngFeet])*1,IIf(([txtBannerType]="Standard" And [txtPaperType]="Standard White Continuous"),[lngCount]*5,IIf(([txtBannerType]="Customized" And [txtPaperType]="Standard White Continuous"),([lngCount]*[lngFeet])*1)))) I just need to say the [txtPaperType] can be Large Format... or Standard White... but I'm a beginner and I can't get it right. Can anyone help me? Thanks in advance. |
#4
|
|||
|
|||
If Statement with And and Or
I also copied and pasted your code with the correct syntax and received the
following error: The expression you entered has the wrong number of arguments. "KARL DEWEY" wrote: I just need to say the [txtPaperType] can be Large Format... or Standard White... Your IIF statements are testing for "Standard" and "Large Format Bright White (#24)" and if true then display [lngCount]*5 which would be a number, not a paper discription. You also have syntax errors that are corrected below -- =IIf(([txtBannerType]="Standard" And [txtPaperType]="Large Format Bright White (#24)", [lngCount]*5, IIf(([txtBannerType]="Customized" And [txtPaperType]="Large Format Bright White (#24)", ([lngCount]*[lngFeet])*1, IIf(([txtBannerType]="Standard" And [txtPaperType]="Standard White Continuous"), [lngCount]*5, IIF([txtBannerType]="Customized" And [txtPaperType]="Standard White Continuous", [lngCount]*[lngFeet]*1)))) Your last test has [lngCount]*[lngFeet]*1 for true results but no false results is entered. False would be like this ... [lngCount]*[lngFeet]*1, "Something is wrong here")))) -- Build a little, test a little. "Ann" wrote: I wrote the following calculation on a form and it does work, however, I know that it can be combined. I have been trying, but no matter how I combine them I keep getting errors. Here is what I have without combining the last two IIfs. =IIf(([txtBannerType]="Standard" And [txtPaperType]="Large Format Bright White (#24)"),[lngCount]*5,IIf(([txtBannerType]="Customized" And [txtPaperType]="Large Format Bright White (#24)"),([lngCount]*[lngFeet])*1,IIf(([txtBannerType]="Standard" And [txtPaperType]="Standard White Continuous"),[lngCount]*5,IIf(([txtBannerType]="Customized" And [txtPaperType]="Standard White Continuous"),([lngCount]*[lngFeet])*1)))) I just need to say the [txtPaperType] can be Large Format... or Standard White... but I'm a beginner and I can't get it right. Can anyone help me? Thanks in advance. |
Thread Tools | |
Display Modes | |
|
|