Creating an Expression which return text from a check box result (1 Viewer)

Paddy1980

Registered User.
Local time
Today, 11:32
Joined
Jan 29, 2009
Messages
18
Hi

I have built a query which simply displays a few checks boxes based on a specific date criteria search.

Because the associated report will not export the check boxes into Word I was thinking if I could have another field in the query which will return a text value based on a check box result.

For instance if checkbox 'A' has been ticked then I would like to have an Expression that displays the value 'A' in it.

Any ideas or alternative methods would be appreciated.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:32
Joined
Aug 30, 2003
Messages
36,140
Try this type of thing

IIf(FieldName = True, "Y", "N")
 

Paddy1980

Registered User.
Local time
Today, 11:32
Joined
Jan 29, 2009
Messages
18
Err...In Expression Builder?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:32
Joined
Aug 30, 2003
Messages
36,140
In the first line of the query grid:

NewFieldName: IIf(FieldName = True, "Y", "N")
 

Paddy1980

Registered User.
Local time
Today, 11:32
Joined
Jan 29, 2009
Messages
18
Cool, thanks for that.

Now If I wanted to expand to multiple check boxes with multiple retuen values. I.e. Checbox A will return A, Checbox B will return B etc so you may have the returned text "A B C"?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:32
Joined
Aug 30, 2003
Messages
36,140
As one field? This type of thing:

NewFieldName: IIf(FieldName = True, "A", "") & " " IIf(OtherFieldName = True, "B", "")...
 

Paddy1980

Registered User.
Local time
Today, 11:32
Joined
Jan 29, 2009
Messages
18
Ok, that works as well but I have 16 check boxes and I have a message box saying it's too complex
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:32
Joined
Aug 30, 2003
Messages
36,140
Can you post a sample of the db that has the error?
 

Paddy1980

Registered User.
Local time
Today, 11:32
Joined
Jan 29, 2009
Messages
18
Screens: IIf([FGC]=True,"FGC","") & IIf([FPT]=True,"FPT","") & IIf([FPO]=True,"FPO","") & IIf([FCD]=True,"FCD","") & IIf([FSL]=True,"FSL","") & IIf([FDD]=True,"FDD","") & IIf([FRR]=True,"FRR","") & IIf([FAD]=True,"FAD","") & IIf([FCC]=True,"FCC","") & IIf([FAT]=True,"FAT","") & IIf([FLE]=True,"FLE","") & IIf([FST]=True,"FST","") & IIf([FNG]=True,"FNG","") & IIf([FN2]=True,"FN2","") & IIf([GEA]=True,"GEA","") & IIf([PAD]=True,"PAD","")

Is the code. I had to remove the SPACE quotes though
 

Users who are viewing this thread

Top Bottom