A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

VB Code to Populate text field based on checkbox selection



 
 
Thread Tools Display Modes
  #1  
Old September 17th, 2009, 05:15 AM posted to microsoft.public.access.forms
JoMoe
external usenet poster
 
Posts: 1
Default VB Code to Populate text field based on checkbox selection

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!
  #2  
Old September 17th, 2009, 07:38 AM posted to microsoft.public.access.forms
Piet Linden[_2_]
external usenet poster
 
Posts: 280
Default VB Code to Populate text field based on checkbox selection

On Sep 16, 11:15*pm, JoMoe wrote:
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.
  #3  
Old September 17th, 2009, 01:33 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default VB Code to Populate text field based on checkbox selection

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.

--
Dave Hargis, Microsoft Access MVP


"JoMoe" wrote:

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!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:44 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.