By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,385 Members | 1,119 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,385 IT Pros & Developers. It's quick & easy.

having problems with the IIf function

Tommyivens
P: 4
Hi all,

I'm having problems with the iff function, i think i have put everything right in but i don't get the right outcome

this is what i typed in a field in a rapport :

=IIf(Forms!test![Keuzelijst met invoervak189] Or Forms!test![Keuzelijst met invoervak191] Or Forms!test![Keuzelijst met invoervak193] Or Forms!test![Keuzelijst met invoervak195] Or Forms!test![Keuzelijst met invoervak197]="Side foot mounting";"[buildingformen]![buildingform]";"[machineofferte]![Buildingform]")

The meaning is when in any of the 5 fields side foot mountig is field in then he has to look the value up in the tabel "buildingformen" otherwise he has to find in the query "machineofferte". No it is working for 50% because when i use the db he is giving me in the field in the rapport or [buildingformen]![buildingform] when we choose Side foot mounting and when we don't he gives [machineofferte]![Buildingform] but he needs to display the value behind it.

Does any body know where my problem is??

Please any help is welcome

Thx
Jun 12 '07 #1
Share this Question
Share on Google+
6 Replies

missinglinq
Expert 2.5K+
P: 3,532
You have to use the ="Side foot mounting" for each of the controls you're testing! As is you're only testing if

Forms!test![Keuzelijst met invoervak197]="Side foot mounting"

Expand|Select|Wrap|Line Numbers
  1. IIf(Forms!test![Keuzelijst met invoervak189] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak191] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak193] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak195] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak197]="Side foot mounting";"[buildingformen]![buildingform]";"[machineofferte]![Buildingform]")
Jun 12 '07 #2

Tommyivens
P: 4
thanks that is great he makes now the right descision of where he has to take the value from but he is still displaying [buildingformen]![buildingform] or [machineofferte]![Buildingform] and not the value that is in the tabel or query for example: B3/B5

any idea what the problem is??


thx
Jun 12 '07 #3

NeoPa
Expert Mod 15k+
P: 31,770
The problem is that you've put the result references in double-quotes. This ensures that the text is treated as text rather than as a reference.
Jun 12 '07 #4

NeoPa
Expert Mod 15k+
P: 31,770
Try instead :
Expand|Select|Wrap|Line Numbers
  1. IIf(Forms!test![Keuzelijst met invoervak189] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak191] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak193] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak195] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak197]="Side foot mounting";[buildingformen]![buildingform];[machineofferte]![Buildingform])
Jun 12 '07 #5

JConsulting
Expert 100+
P: 603
Try instead :
Expand|Select|Wrap|Line Numbers
  1. IIf(Forms!test![Keuzelijst met invoervak189] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak191] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak193] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak195] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak197]="Side foot mounting";[buildingformen]![buildingform];[machineofferte]![Buildingform])

How about replacing the semicolons with commas?
J

Expand|Select|Wrap|Line Numbers
  1.  
  2. IIf(Forms!test![Keuzelijst met invoervak189] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak191] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak193] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak195] ="Side foot mounting" Or Forms!test![Keuzelijst met invoervak197]="Side foot mounting",[buildingformen]![buildingform],[machineofferte]![Buildingform])
  3.  
Jun 13 '07 #6

NeoPa
Expert Mod 15k+
P: 31,770
The semi-colon (;) versus comma (,) thing is a national issue. I don't know where it's set but I just know that some countries use the semi-colon (;) where we use the comma (,) as a list (parameter) separator.
Jun 13 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.