Translate datatype Yes/No to text and add it to other text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

One of my fields has a datatype of Yes/No. How do I show text for this and
add this text to the beginning of another text field.
For example, Captain = Yes/No and attach this to Name
On the report it should show "Captain Smith" if it is Yes and "Smith" if it
is No.
 
You've put "data in field names" which is not a good practice -- as in this
case, it often leads to complex code. It would be better to have a field
Title, one of the values of which could be "Captain".

With what you have, however, I believe you can do what you want with the
following expression as Control Source:

= IIF([Captain]=True,"Captain","") & PersonsName

Life gets more complicated if you have Yes/No fields for Lieutenant,
Colonel, and other ranks.

Larry Linson
Microsoft Access MVP
 
If I did change it to values or just text, how would I combine these two
fields?

Larry Linson said:
You've put "data in field names" which is not a good practice -- as in this
case, it often leads to complex code. It would be better to have a field
Title, one of the values of which could be "Captain".

With what you have, however, I believe you can do what you want with the
following expression as Control Source:

= IIF([Captain]=True,"Captain","") & PersonsName

Life gets more complicated if you have Yes/No fields for Lieutenant,
Colonel, and other ranks.

Larry Linson
Microsoft Access MVP


acon said:
One of my fields has a datatype of Yes/No. How do I show text for this
and
add this text to the beginning of another text field.
For example, Captain = Yes/No and attach this to Name
On the report it should show "Captain Smith" if it is Yes and "Smith" if
it
is No.
 
Assuming your field name was [Title] then you would use an expression like:
=[Title] + " " & [PersonsName]

--
Duane Hookom
MS Access MVP


acon said:
If I did change it to values or just text, how would I combine these two
fields?

Larry Linson said:
You've put "data in field names" which is not a good practice -- as in
this
case, it often leads to complex code. It would be better to have a field
Title, one of the values of which could be "Captain".

With what you have, however, I believe you can do what you want with the
following expression as Control Source:

= IIF([Captain]=True,"Captain","") & PersonsName

Life gets more complicated if you have Yes/No fields for Lieutenant,
Colonel, and other ranks.

Larry Linson
Microsoft Access MVP


acon said:
One of my fields has a datatype of Yes/No. How do I show text for this
and
add this text to the beginning of another text field.
For example, Captain = Yes/No and attach this to Name
On the report it should show "Captain Smith" if it is Yes and "Smith"
if
it
is No.
 
Back
Top