If

Silverblood

Registered User.
Local time
Today, 09:56
Joined
Aug 4, 2005
Messages
39
I know how to put in the IF function but i don't know where to put them, can some1 please tell me that
 
Would this help you :
IIf Function Example
This example uses the IIf function to evaluate the TestMe parameter of the CheckIt procedure and returns the word "Large" if the amount is greater than 1000; otherwise, it returns the word "Small".

Function CheckIt (TestMe As Integer)
CheckIt = IIf(TestMe > 1000, "Large", "Small")
End Function
 
Silverboood - are you asking why you would use IIF statements? I use them a lot on FORMS when displaying different data depending on different variables. For example- we use a code A if a client needs to be kept track of. If the client has been on the system for more than 3 days the name appears in Column A. If the client has been on the system between 4 and 10 days it moves to Column B - and so on. Use a Unbound Field to enter the IIF stmt into. I also use Conditional formatting using IIF stmts. I hope this helps -

Yrs, Dika
 
IIf() functions can be used any place a function can be used. I do not recommend using them in VBA since they work differently in VBA and can cause unexpected errors. The difference is that in VBA, all parts of the expression are evaluated whether they are true or false so in VBA, the following IIf() would fail with a divide by zero error even though it would work fine in SQL or as an expression in a controlSource:

IIf(MyField = 0, 0, OtherField/MyField)
 

Users who are viewing this thread

Back
Top Bottom