IIF Function

sorry, i cannot upload at this time. i appreciate the help thus far, but i understand if there is nothing more that can be done. something else worth noting, some of these switch aren't taking effect when i access the form from my switchboard. if i exit the switchboard and enter the form the old fashioned way, it seems to work... sometimes... ugh
 
it all works as a standalone form, just when i use it as a subform it stops working
 
Is this "Example" business just generic info for here and your fields you are referring to really different? If so, I think you'll need to post EXACTLY what you have for your formula so we can see why it would make a difference in being on a subform over a main form because the code we've seen up to this point would work no matter where it was as long as the field was in the underlying recordsource.
 
i have heard in the past on other boards about Me.Dirty=True being in the code when you access a subform from a switchboard or something to that affect?
 
i have heard in the past on other boards about Me.Dirty=True being in the code when you access a subform from a switchboard or something to that affect?

Doubtful that has to do with that here. But without seeing the actual formula, we can't make any statements about what could be happening.
 
thank you boblarson, i firgured out my problem, just a few repeating records, causing the computer to get confused. you have been a huge help! i will surely be posting other questions here hsortly, and i always appreciate your assistance.
 
Glad you got the problem sorted. Good luck with the rest of your project. :)

yourewelcome3.jpg
 
is there any term or anything to use in this switch that is just generic? what i am looking for is something like below: Switch([Example]=any value at all, "Example" ?
 
is there any term or anything to use in this switch that is just generic? what i am looking for is something like below: Switch([Example]=any value at all, "Example" ?


This should do it if there is any value at all.

=Switch(Len([Example] & "") > 0,"Example")
 
This should do it if there is any value at all.

=Switch(Len([Example] & "") > 0,"Example")
ok, the value in question is a date formatted text box. if that makes any difference at all. and this will also hopefully be added into the string of the previous expression, except the value i want to analyze is coming from a different text box
 
ok, the value in question is a date formatted text box. if that makes any difference at all.
=Switch(Len([Example] & "") > 0,"Example")

Should work with dates too.
and this will also hopefully be added into the string of the previous expression, except the value i want to analyze is coming from a different text box
Not sure what you mean there. Can you be a bit more specific?
 
=Switch(Len([Example] & "") > 0,"Example")

Should work with dates too.

Not sure what you mean there. Can you be a bit more specific?
sorry, that last part was supposed to be a question. qill i add this into the control source along with the rest of my IIf expression? if so, would you be able to script it for me?
 
I can try but instead of using EXAMPLE, please use the REAL names. Using Example only serves to frustrate things and makes it very difficult to see what it should really be.
 
I can try but instead of using EXAMPLE, please use the REAL names. Using Example only serves to frustrate things and makes it very difficult to see what it should really be.
=IIf(Len([Status] & "")=0,"",Switch([Status]=1,"One",[Status]=2,"Two",[Status]=3,"Three",[Status]=4,"Four",[Status] Not In (1,2,3,4),""))
that is my current expression, i then have another text box, formatted to show the date (__/__/____) where if anything is inputed, i would like it to return "Five", just like the other words are returned above...
 
The other text box would need to have its own formula if you want it to display something in it. It would not be appended to the other.
 
so with that said, the text box that has been returning, one, two, three, four. will not be able to display five like i was hoping because i cannot tie this code into it?
 
You want the same text box that has One, Two, Three, etc. in it to return Five? Wouldn't that overwrite the stuff for 1, 2, 3, and 4? I'm not picturing this. If you want the date box to say Five it is just as I said. If you want the text box where 1, 2, 3, 4 are converted, what is the criteria for showing FIVE?
 
You want the same text box that has One, Two, Three, etc. in it to return Five? Wouldn't that overwrite the stuff for 1, 2, 3, and 4? I'm not picturing this. If you want the date box to say Five it is just as I said. If you want the text box where 1, 2, 3, 4 are converted, what is the criteria for showing FIVE?
the criteria for showing five comes from a text box unrelated to the text box that populates "1,2,3,4". if this new text box comes back with a date greater than today (sorry i just changed my approach on that, as opposed to anything but null), i hope that the text box where i have manipulated the control source will return "Five". i hope that makes some sense.
 
Okay, I think I understand. So, we should be able to go with:

=IIf(IsNull([YourDateFieldNameHere]),"Five",IIf(Len([Status] & "")=0,"",Switch([Status]=1,"One",[Status]=2,"Two",[Status]=3,"Three",[Status]=4,"Four",[Status] Not In (1,2,3,4),"")))
 

Users who are viewing this thread

Back
Top Bottom