Re: display / return string data instead of code from lookup table
- From: Emelina Bumsquash <EmelinaBumsquash@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 8 Nov 2007 16:36:00 -0800
Hi John, thanks for your answer. I've used the calculated field option for
most of them as it worked easier and i'm not too good at access!
however, i'd like to use the conversion table option on one of the fields to
display longer string data to avoid having to write cumbersome calculations.
i've done a conversion table as you suggested and joined the relevant field
to the FldValue. However, I now have 2 problems:
1. all the values in the field now seem to be 'resetting' to 0.
2. I don't know how to display the FldConvert in the query as you advise in
your reply.
can you help? much appreciated!
"John Spencer" wrote:
You can use a calculated field or you can use a table with with the values.
that are stored and the equivalent value to display. The related table is
the most flexible and is generally the easiest to implement.
Calculated field:
Field: ShowYesNo: IIF([FieldName]=1,"No", IIF([FieldName]=2,"Yes",Null))
With the conversion table:
FldValue: (1,2,3, etc)
fldConvert: ("No","Yes","Maybe")
Add the table to your query, join the field in the main table to fldValue in
the conversion table and display FldConvert in the query. If you don't
always have a value in the main table then make the join an outer join by
double clicking on the join line and selecting the option for ALL records in
the main table and only matches in the conversion table.
One additional option is to write a VBA function that you can call and pass
the value to and then have it return the equivalent value.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
"Emelina Bumsquash" <EmelinaBumsquash@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:77EA4B9D-AD1E-46C3-B9B1-4ABA3BF127E5@xxxxxxxxxxxxxxxx
Is there any way to get a query to return string data rather than code
even
when the code data is stored in the table? i.e For a given field if "no" =
1
and "yes" = 2, the query currently returns the '1' or '2' (given that this
is
the value stored in the table). However, I'd like it to return "yes" or
"no"
instead if possible? can anyone help? I know this sort of thing can be
accomplished if I make a report based on the query but I'd really like to
do
it directly in the query if possible?
Thanks in advance for any help!
- Follow-Ups:
- Re: display / return string data instead of code from lookup table
- From: John Spencer
- Re: display / return string data instead of code from lookup table
- References:
- Re: display / return string data instead of code from lookup table
- From: John Spencer
- Re: display / return string data instead of code from lookup table
- Prev by Date: Re: Count Unique Values in a Totals Query
- Next by Date: RE: Crosstab Query Troubles Again
- Previous by thread: Re: display / return string data instead of code from lookup table
- Next by thread: Re: display / return string data instead of code from lookup table
- Index(es):
Relevant Pages
|