excel if on query

romanticode

Registered User.
Local time
Tomorrow, 05:00
Joined
Oct 26, 2007
Messages
39
on my query there's a colunm which contain based on two other column. so is it posible using if function like on excel or i have to use module to do it?
i've read iif function but still dont understand.

what i need to do is;
if column A contain 1 and column B contain 2A, column C will be filled with "so close".
if column A contain 3 and column B contain 2B, column C will be filled with "near".
and so on.

How can i implement that?
thanks
 
Starting Point

You could try something like this...

Expr1: IIf([column A] like '*1*' And [column B] like '*2A*',"so close", next condition)
 
Simple Software Solutions

Hi

An alternative is to do what you suggested and create a function in a module

Example

Public Function Test(ByVal Item1, ByVal Item2) As String

If Item1 = x And Item2 = y Then

Test = z

ElseIf Item1 = a And Item2 = b Then

Test = c

Elseif.....

Endif

End Function

Then in your query in the column that you want to show the results use the following

Result:Test(Column1,Column2)

Code Master::cool:
 

Users who are viewing this thread

Back
Top Bottom