Text Function (1 Viewer)

sargon

Registered User.
Local time
Today, 08:34
Joined
Mar 13, 2006
Messages
30
Hello,

I have two text columns in a query (colA , colB),and one CheckBox column (colChek).And I want to create
column colC:Valid([colChek],[colA],[ColB]).
I want to make a Module Function to select between colA, ColB like this:

Function Valid(Chk As Boolean, Var1 As Variant, Var2 As Variant) As Variant

If Chk = 0 Then
Valid = Var1
Else
Valid = Var2
End If
End Function

This function works only for numbers, what I must modify to work for Text?

?Valid(1,X,J)
 

RuralGuy

AWF VIP
Local time
Yesterday, 23:34
Joined
Jul 2, 2005
Messages
13,826
You do not need a function for this operation. It can be done in a query with an IIF() statement.
Edit: colC:=IIF([colChek],[colA],[ColB]).
 

Users who are viewing this thread

Top Bottom