By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,045 Members | 1,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,045 IT Pros & Developers. It's quick & easy.

Lookup List with Code Hiding?

P: n/a
Hi,

Is there a way to use a 2 column table as a lookup for a combo box,
having one field show up on the form, and the other field actually
written to the output table?

Here's an example:

I have a reference table called "R" with the following values: { (0,
'Price'),
(1, 'Comp'), (2, 'Alt') }

I also have a table called "T" that uses field 1 from "R" (eg: {0, 1,
2}).

I'm also using a form as an interface to "T". Now since this is
intended for end user use, I want to avoid using codes. So when the
user gets to the combo box that uses "R" as a source, the user will
see { 'Price', 'Comp', 'Alt' }. And when an item is selected, one of
the previous list will be shown in the control. However, I would like
"T" to get the corresponding code.

So if the user picks 'Price', s/he will see 'Price' on the form at all
times, but T will receive 0. And so forth.

Is there a way to do this without any programming?
Thanks.
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
That's a pretty standard thing. Set the Row Source Type property to
Table/Query, and set the Row Source to a query that returns both columns.
Set the Column Count to 2, and set the Column Widths to 0;1 (or whatever
width you need to display the text). Set the Bound Column to 1. Set the
Control Source to the appropriate field in table T.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

<xm****@yahoo.com> wrote in message
news:4a**************************@posting.google.c om...
Hi,

Is there a way to use a 2 column table as a lookup for a combo box,
having one field show up on the form, and the other field actually
written to the output table?

Here's an example:

I have a reference table called "R" with the following values: { (0,
'Price'),
(1, 'Comp'), (2, 'Alt') }

I also have a table called "T" that uses field 1 from "R" (eg: {0, 1,
2}).

I'm also using a form as an interface to "T". Now since this is
intended for end user use, I want to avoid using codes. So when the
user gets to the combo box that uses "R" as a source, the user will
see { 'Price', 'Comp', 'Alt' }. And when an item is selected, one of
the previous list will be shown in the control. However, I would like
"T" to get the corresponding code.
t
So if the user picks 'Price', s/he will see 'Price' on the form at all
times, but T will receive 0. And so forth.

Is there a way to do this without any programming?
Thanks.

Nov 13 '05 #2

P: n/a
xm****@yahoo.com wrote in message news:<4a**************************@posting.google. com>...
Hi,

Is there a way to use a 2 column table as a lookup for a combo box,
having one field show up on the form, and the other field actually
written to the output table?

Here's an example:

I have a reference table called "R" with the following values: { (0,
'Price'),
(1, 'Comp'), (2, 'Alt') }

I also have a table called "T" that uses field 1 from "R" (eg: {0, 1,
2}).

I'm also using a form as an interface to "T". Now since this is
intended for end user use, I want to avoid using codes. So when the
user gets to the combo box that uses "R" as a source, the user will
see { 'Price', 'Comp', 'Alt' }. And when an item is selected, one of
the previous list will be shown in the control. However, I would like
"T" to get the corresponding code.

So if the user picks 'Price', s/he will see 'Price' on the form at all
times, but T will receive 0. And so forth.

Is there a way to do this without any programming?
Thanks.


Yeah, simple. Create a combobox. Set the Column Count property to 2.
Set the Column Widths property to "0;1" (first one MUST be zero).
Then the user will see and can choose from the data in the second
column, but the data in the first column is what gets stored in the
database. The rowsource would be something like:

SELECT IDNo, ItemText
FROM TableX
WHERE...
ORDER BY ItemText

The wizard pretty much does all this stuff for you...
Nov 13 '05 #3

P: n/a
Hi,
Thanks to everyone who responded to the post. I used 0;1 for the
column widths and everything works beautifully. Only the descriptions
show up on the controls, but behind the scenes the code gets written
to the table.
Take Care!
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.