Format textbox of form based on selection in a combobox

  • Thread starter hotrod1952 via AccessMonster.com
  • Start date
H

hotrod1952 via AccessMonster.com

I have a form with a combobox (value list) example:
heat;1;cool;2;soak;3;fuel;4....... When a selection is made in the combo of
the form the focus is set to the textbox. I would like to format the textbox
as "hh:mm" or a fixed four digit number in appearance on the form depending
on the choice on the combo. What event should I use what code to format the
textbox? Both the combo and the textbox are unbound. I plan to add a button
to take the value and enter it as text into a table.
 
J

Jeff Boyce

A potential downside of using a value list for the combobox is the
maintenance you'll need to do if the categories ever change.

Another approach is to use a (small) "lookup" table that contains valid
values. That way, if a new category is added, it's a simple matter to add a
new row to the table.

You mention a form, but very little about the underlying data structure ...
it all starts with the data.

If you add code to the AfterUpdate event of the combobox, it might look
something like:

Me!YourTextBox = Me!cboYourCombobox.Column(1)

Your mileage may vary...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
H

hotrod1952 via AccessMonster.com

Thanks! I will approach it from that method!

Jeff said:
A potential downside of using a value list for the combobox is the
maintenance you'll need to do if the categories ever change.

Another approach is to use a (small) "lookup" table that contains valid
values. That way, if a new category is added, it's a simple matter to add a
new row to the table.

You mention a form, but very little about the underlying data structure ...
it all starts with the data.

If you add code to the AfterUpdate event of the combobox, it might look
something like:

Me!YourTextBox = Me!cboYourCombobox.Column(1)

Your mileage may vary...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
I have a form with a combobox (value list) example:
heat;1;cool;2;soak;3;fuel;4....... When a selection is made in the combo
[quoted text clipped - 8 lines]
button
to take the value and enter it as text into a table.
 

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