hi
i need to use the IF formula in a ms-access query. Please help.
Reg
Deepak
You cannot use If .. Then directly in a query.
You can create a User Defined function using If and then call it from
the query:
Public Function SomeFunction(TextIn)
Dim Result as String
If TextIn = "Good" Then
Result = "Great Job"
ElseIf TextIn = "Bad" Then
Result = "Try Harder"
Else
Result = "You're doing well"
End If
SomeFunction = result
End Function
In the query, use:
Exp:SomeFunction([FieldName])
However, you can use the Immediate If ... IIf() directly in a query:
Exp:IIf([SomeField]="Good","Great Job", "IIf([Somefield]= "Bad","Try
Harder","You're doing well"))