text box/combo box problem

Dylan Ross

Registered User.
Local time
Today, 02:08
Joined
Jul 24, 2003
Messages
13
Newbie here.

I think this is a pretty simple issue, but maybe not.

I have a database where I am using a combo box to select values from a table.

There are other values associated with the value I am choosing in my combo box that I would like to automatically update in the text box once I select a value.

EX: Combo box: pulls from a table that contains job code/job title/salary grade

Text Box: Once a job code is selected, I'd like the text box field to reflect the job title that is associated with that job code.

Can this be done?

Dylan Ross
 
Yep. Include all the fields you want to display in the query supplying the combo, Add unbound textboxes to display that data and set the controlsource of the respective control to
=Forms!NameOfForm!NameOfCombo.Column(x) where x is the column number of the data you want to display - starting at 0 for the first column.
 
Thanks for the info. I understand what you're doing, I only have one issue. For some reason when I type your suggested sytax at the control source, it continues to tell me the syntax is incorrect. It doesn't like the "=" sign.

Here's literally what I'm typing in :

=Forms!qry_JobInfo!JobCodeCombo.Column(1)

The Query Name is: qry_JobInfo

The Combo Box Name is: JobCodeCombo

The data I want to show up in the text box is in the 2nd column of my combo box (also the second column of the query feeding the combo box), so based on what you suggested earlier, that would be column (1) if the first column is (0).

Any other suggestions?

Thanks in advance for your assistance!

DR
 
=Forms!NameOfForm!JobCodeCombo.Column(1)

I'm assuming your form is in Form Mode also here, not Datasheet.
 
I tried your second suggestion and here's what I typed. You are correct. The form I am working in is in form mode.

Here's my syntax:

=Forms!Job Opening Form!JobCodeCombo.Column(1)

Here's the error message I receive:

The expression you entered contains invalid syntax.

You may have entered an operand without an operator


Is there something I should be placing before the "=" sign at the beginning of the statement?

Thanks again for your patience.

DR
 
I haven't really read the entire thread, but the problem with this expression:
=Forms!Job Opening Form!JobCodeCombo.Column(1)
is that it has spaces so Access is not interpreting it the way you want. Try:
=Forms![Job Opening Form]!JobCodeCombo.Column(1)
 
Thanks a million dcx693! That was the problem. It's doing exactly what I wanted now!

DR
 
The credit goes to Fizzio. I just made a small syntax correction.
 
Hi, not my thread but got a question.

using the syntax :

=Forms!frmBanquet![Group_Group Name].Column(1)

for me works great. But the same syntax for subsequent columns doesn't seem to work. ie

=Forms!frmBanquet![Group_Group Name].Column(2)
=Forms!frmBanquet![Group_Group Name].Column(3)
=Forms!frmBanquet![Group_Group Name].Column(4)

The text boxes stay blank. Any ideas where to look for the problem?

thx in advance
dat_guy
 
Look at the number of columns in your Combo Box Properties - it is likely set to too few.
 
You don't need the forms references either if the combo is on the same form as the textboxes
=[ComboName].[Column](1) etc
 
Thanks to both Fizzio and Rich. Works beautifully.:) Now I have another question I would like to ask.

Is there a way I can disallow changes to be make via this combo on this form?
I set the locked property on the txtBoxes to true, and it works fine. But when I do the same to the comboBox, I cannot select anything in it.

These controls(this cmbBox and few txtBoxes) on this form are only used to pull up and view contact information, while entry is done in the lower portion of the form.

thx for any help
Dat_Guy
 
I solved my problem. Just limited it to the list.
 

Users who are viewing this thread

Back
Top Bottom