VB Code to Populate text field based on checkbox selection

J

JoMoe

I have a text field called "Air" that I want automatically updated
(using a form) with air direction based on 3 check boxes. If check
box "AirUp" is checked, then "Air" = "UP". If "AirDn" is checked,
then "Air" = "DN". If "AirOff" is checked, "Air" = "OFF". I'm new to
VB and I can make one or the other work, but can't get it to work if I
go to change the check box selection. Can someone help with with the
Code? Thanks!
 
P

Piet Linden

I have a text field called "Air" that I want automatically updated
(using a form) with air direction based on 3 check boxes.  If check
box "AirUp" is checked, then "Air" = "UP".  If "AirDn" is checked,
then "Air" = "DN".  If "AirOff" is checked, "Air" = "OFF".  I'm new to
VB and I can make one or the other work, but can't get it to work if I
go to change the check box selection. Can someone help with with the
Code?  Thanks!

Make life easy on yourself and use a combobox. You can store the real
value in the hidden column and show whatever you want in the next
column. No code required.
 
K

Klatuu

I would suggest putting the check boxes in an option group. As you have it,
what happens if a user checks more than one box? With an option group, the
use can select only one box. Also, rather than carrying the text value in
the table, it would be easier to use the Option Button Values. The reason
being is that when you navigate to a new record, you would have to put code
in the form's current event to show the correct box checked. Using the
option group, it will handle itself.
 

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