Looking up Values

A

ake

I think my problem is about looking up a value.
I have a table with the following values

Error Weight of the Error
Incorrect Posting 3
Incomplete Documentation 2
Unclear Item 1

I put them in the form as combo box. My problem is how to create two fields
in the form that will automatically pull the value of the error, as for
example when I choose in the combo box--Incorrect Posting, the Weight of the
error field would automatically show "3"

Please help. Thanks in advance.
 
D

Dirk Goldgar

ake said:
I think my problem is about looking up a value.
I have a table with the following values

Error Weight of the Error
Incorrect Posting 3
Incomplete Documentation 2
Unclear Item 1

I put them in the form as combo box. My problem is how to create two
fields
in the form that will automatically pull the value of the error, as for
example when I choose in the combo box--Incorrect Posting, the Weight of
the
error field would automatically show "3"

Please help. Thanks in advance.


There are a couple of ways to go about this. One simple way is to give your
combo box two columns, with a rowsource that includes both the fields from
the table: ErrorName and ErrorWeight (or whatever the names of the fields
really are). Then add a text box to your form with a ControlSource
expression that display's the combo box's second column, like this:

=[cboError].[Column](1)

In the above, I've used "cboError" as the name of the combo box. You should
change that as needed.

Note that "Error" itself is not a good name for a field, as it is the same
as an existing function.
 
A

ake

Thanks a bunch, works like magic :)

Dirk Goldgar said:
ake said:
I think my problem is about looking up a value.
I have a table with the following values

Error Weight of the Error
Incorrect Posting 3
Incomplete Documentation 2
Unclear Item 1

I put them in the form as combo box. My problem is how to create two
fields
in the form that will automatically pull the value of the error, as for
example when I choose in the combo box--Incorrect Posting, the Weight of
the
error field would automatically show "3"

Please help. Thanks in advance.


There are a couple of ways to go about this. One simple way is to give your
combo box two columns, with a rowsource that includes both the fields from
the table: ErrorName and ErrorWeight (or whatever the names of the fields
really are). Then add a text box to your form with a ControlSource
expression that display's the combo box's second column, like this:

=[cboError].[Column](1)

In the above, I've used "cboError" as the name of the combo box. You should
change that as needed.

Note that "Error" itself is not a good name for a field, as it is the same
as an existing function.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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