View Single Post
  #16  
Old February 11th, 2010, 07:16 PM posted to microsoft.public.access.forms
oldblindpew
external usenet poster
 
Posts: 128
Default Show code meaning rather than code value

Dear self,

To use a Text Box to display the Code's Meaning from a separate Lookup
Table, just go to the Query Builder for the form's Record Source, click on
Show Table, and add the Lookup Table.

Next, create a link between the Lookup Table's Code field and the
corresponding field in the child table. This relationship is only used in
the query, and will not affect the relationships shown under Database Tools
/Relationships.

Next, add the Code and Meaning fields from the Lookup Table to your query,
(or just specify all fields, since there are only the two).

Finally, specify the Meaning field's name as your Control Source for the
Text Box in your form.

Best of Luck,
OldBlindPew

"oldblindpew" wrote:

Jeff, thanks for replying.

I have a lookup table with two fields: Code and Meaning. Sample values
would be "A" and "Active", respectively.

My child table has a field for the Code as a foreign key, but I want my
form's textbox to show Meaning rather than Code, e.g. "Active" rather than
"A". As stated previously, I know a Combo Box will do this, and I know how
to make it work, so this was not my question. My question is how to do it
with a Text Box.

My reason for wanting a Text Box is aesthetic. In my form, this control
will be display-only. I don't see any point in presenting a non-functional
Combo Box to the user. In fact, I think a locked Combo Box should change
appearance to look like a locked Text Box. If it's locked (read-only) why
should there even be a down arrow/selector button followed by a drop-down
pick list, which the user is not going to be able to use anyway?

Thanks,
Pew

"Jeff Boyce" wrote:

Not sure how you're using the term "meaning"...

Are you saying you have a table somewhere that has a couple of fields, a
code and a "meaning" (is that the same as a title, or description or ...)?
And that you want to see that second part instead of the code?

Then yes, a combobox can do that quite easily.

First build a query that returns both code and "...". Then base your
combobox on that query.

In the design view, highlight the combobox, and set 2 columns, and set the
width of the first column (i.e., the code) to 0 (zero).

Now when you use the combobox, the code is what the combobox is storing in
the underlying field, but the "..." is what it is displaying in the form.

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.

"oldblindpew" wrote in message
...
I have a text box in a form that is displaying (as it should) the value of
a
code that is stored in the bound field (hope I'm saying this right). I
want
to display the code's meaning rather than its value.

I know a combo box would do it, and I'll use one if I have to, but I only
want to display the meaning, whereas a combo box is for picking a value.

Thanks,
OldBlindPew



.