Combobox to fill textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The problem I have at the moment is that I have a Combox box with 6 values in
it. If someone chooses value 1 it should populate a Textbox with a fixed
string, value 2 with a different string etc. I am not sure of the procedure
to use. How does Access relate the chosen record to the row?
If I write a procedure for the AfterUpdate should it look like the following:

Me.Comboxbox.Value = Me.Textbox.value

Should that be it ??
Thanks in Advance
 
Two Ammendments: The Textbox should then store the String value in table
Invoicing in the field description and the form is a continuous form.

Thanks for any Help
 
Assuming that the value in the combobox is NOT the value you want
stored.

In the afterupdate event on the combobox
select case combobox
case 1
me.textbox = "the value that you want to go there on condition 1"
case 2
me.textbox = "the value that you want to go there on condition 2"


etc
select end

Maybe a better option.
1) set up a table as the source for your combo box with two fields

tblcombobox
field1 Value to show in dropdown
field2 Value to move to the text box


2) make the above table the source for the combo with 2 columns bound
to column 1 and 0 lenth for column 2.

3) In the after update event
me.textbox = me.combobox.column(1) ' the col# is 0 based
0=1st col 1 = 2nd col.

That way there is no code change if you add another value combination
OR you want to change the textbox value. All you have to do is change
the table.
 
Back
Top