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

Display two fields by selecting value in one

P: n/a
Greetings,

I have a table with two columns. On my form, I have a combo field that
displays the contents of the first column. Upon selecting an item in
this combo field, I would like to then display the corresponding value
of the second column in a read-only field. I tried to use Expression
Builder in the Control Source for the second field, but no matter what
I try, I get #Name? results.

Can anyone tell me how to make this type of situation work?

Thank you for your time.

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Br
kl******@nd.edu wrote:
Greetings,

I have a table with two columns. On my form, I have a combo field that
displays the contents of the first column. Upon selecting an item in
this combo field, I would like to then display the corresponding value
of the second column in a read-only field. I tried to use Expression
Builder in the Control Source for the second field, but no matter what
I try, I get #Name? results.

Can anyone tell me how to make this type of situation work?

Thank you for your time.


Create a text field and set it's controlsource as...

=[MyComboBox].Column(1)

Change the value of the column number to suit the one you want. Note:
column numbers start at zero.
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #2

P: n/a
Br@dley wrote:

Create a text field and set it's controlsource as...

=[MyComboBox].Column(1)

Change the value of the column number to suit the one you want. Note:
column numbers start at zero.
--


Thank you for taking the time to reply. I believe I understand what
is going on here now. You use the query that populates the combo box
to also pull the data for this field. I did that by altering the query
code in the Row Source for the combo box. Then, I set the Column
Widths to 0";1";0" and increased the Column Count to 3. (The table
that Im referencing actually has a RecordID column as the first column,
so I have been doing this type of thing right along... but didnt
realize it. I bound to column 1.)

I then placed your suggestion in the Control Source for the text field.
Unfortunately, I get the same error.

I did receive another private email with the suggestion that I put code
in the AfterUpdate event of the combo box and push the value to the
field. Essentially, it the same code. Now, that works! The only
problem is that when you move off the record, the field is still
populated. I have to include some code to constantly set it the the
right value for the current record.

Any idea why that would be? At any rate, it appears that I have this
issue resolved. Thanks again for your efforts.

Nov 13 '05 #3

P: n/a
Br
kl******@nd.edu wrote:
Br@dley wrote:

Create a text field and set it's controlsource as...

=[MyComboBox].Column(1)

Change the value of the column number to suit the one you want. Note:
column numbers start at zero.
--


Thank you for taking the time to reply. I believe I understand what
is going on here now. You use the query that populates the combo box
to also pull the data for this field. I did that by altering the
query code in the Row Source for the combo box. Then, I set the
Column Widths to 0";1";0" and increased the Column Count to 3. (The
table that Im referencing actually has a RecordID column as the first
column, so I have been doing this type of thing right along... but
didnt realize it. I bound to column 1.)

I then placed your suggestion in the Control Source for the text
field. Unfortunately, I get the same error.

I did receive another private email with the suggestion that I put
code in the AfterUpdate event of the combo box and push the value to
the field. Essentially, it the same code. Now, that works! The only
problem is that when you move off the record, the field is still
populated. I have to include some code to constantly set it the the
right value for the current record.

Any idea why that would be? At any rate, it appears that I have this
issue resolved. Thanks again for your efforts.


Yeah, an AfterUpdate solution works well too...

Put some code on the OnCurrent event of the form to set the value when a
record is first loaded (perhaps to clear your text box).
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.