Concatenation Error (1 Viewer)

Lanason

Registered User.
Local time
Today, 12:44
Joined
Sep 12, 2003
Messages
258
I am displaying two filed in a form but they are mutually exclusive so I want which ever has data

when I display the fields individually [System] or [Software Name]) I don't get an error

when I do this =IIf([Category]="GB",[System],[Software Name]) I get #error

when I do this =IIf([Category]="GB","GB","Not GB") works fine

What am I doing wrong ???
 

Minty

AWF VIP
Local time
Today, 12:44
Joined
Jul 26, 2013
Messages
10,372
Are you doing this on the form or in the underlying query for the form?
I would suggest the latter is the best way forwards.

MyDisplayField : IIf([Category]="GB",[System],[Software Name])
 

Lanason

Registered User.
Local time
Today, 12:44
Joined
Sep 12, 2003
Messages
258
I'm am doing in the form --- let me try in query
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:44
Joined
May 7, 2009
Messages
19,246
you get error because the fields are not in the form.
use query as suggested or add the fields and make their visible property to No.
 

Lanason

Registered User.
Local time
Today, 12:44
Joined
Sep 12, 2003
Messages
258
worked fine in the query many thanks
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 21:44
Joined
Jan 20, 2009
Messages
12,854
If the fields are mutually exclusive it means that it is possible to store invalid data in your table by having data in both. Good table design avoids such conundrums.

One way around this is to store the values in the same field. The control label on the form could be changed depending on the Category.

This may not be the ideal solution either. It would be interesting to know more about your data and table structure. You might be heading down a less than optimum track in the big picture.
 

Users who are viewing this thread

Top Bottom