New field in a query

M

Maracay

Hi Guys,

I have a query with a field call YNDATA(the one that is a check mark), what
I want is to create another field in the query that when YNDATA is true, this
new field has the word "DATA" if is false is just empty.

I will apprecite any help

Thanks
 
J

Jeff Boyce

Take a look at Access HELP for the syntax of the IIF() statement. You can
use it to add a field in a query that's based on the values in another
field.

It might look something like (untested):

NewField: IIF([YourField] <> 0,"DATA","")

A couple of considerations ... "empty" means different things to you than to
Access. You'll need to decide whether you want a zero-length string (see
example) or a null, or ...?!

The other is that zero, as in "<>0" ... a Yes/No field stores "0" for
No/False/Unchecked, and something not zero for Yes/True/Checked.

Good luck!

--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
K

kc-mass

In the query design panel use a blank column and enter the following:
IsData: IIF(YNDATA,"DATA","")

Regards

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top