GP
10-04-2001, 03:20 AM
Could anybody out there be kind enough to explain the "IIF" function to me??
Grateful thanx in advance,
GP.
Grateful thanx in advance,
GP.
|
View Full Version : "IIF" Function GP 10-04-2001, 03:20 AM Could anybody out there be kind enough to explain the "IIF" function to me?? Grateful thanx in advance, GP. Haytham 10-04-2001, 04:36 AM Hi GP IIf Function if to filter your data into a new field. If you have a condition and your data should be accordingly, you can use IIf function. e.g. a field with some figures . In a new field If the first field contains 1 put a specific value let us 2 otherwise, put 3 so you put the code as follows: If Me.FirstField = 1 Then me.SecondField = 4 Else Me.SecondField = 3 End If If - Then - End If is always together.. HTH R. Hicks 10-04-2001, 04:48 AM Basically here is the breakdown: IIf(ExpressionToEvaluate, ReturnValueIfTrue, ReturnValueIfFalse) HTH RDH MikeAngelastro 10-04-2001, 11:00 AM According to the Litwin et al tome on Access, you should never use the IIf (Immediate If) statement. They say that both options are run whether they are needed or not. The result is that execution is slow. They recommend using pure If satements instead; regular Ifs don't this problem. Of couse you must approach your query differently by creating your own public function containing the if statements needed to get the result you want. The greater the number of records in your recordset the faster using your own function will be compared to using the IIf statement. |