16257 how to automatically put a label when i click an option button?
Sign Up |  Live StatsLive Stats    Articles 37,330| Comments 177,267| Members 19,415, Newest GP Kaur| Online 420
Home Contact
 (Forgotten?): 
    Sikhism
    For best SPN experience, use Firefox Internet Browser!


                                                                   Your Banner Here!    




Click Here to Register/Sign Up Daily Hukamnama Member Blogs Downloads Website Navigation Help Fonts Tags
Sikh Philosophy Network » Sikh Philosophy Network » Current News » Information Technology » how to automatically put a label when i click an option button?

how to automatically put a label when i click an option button?

Our Donation Goal : Why Donate? : Donate Today! : Donate Anonymously (ਗੁਪਤ) : Our Family of Supporters
Goal this month: 500 USD, Received: 115 USD (23%)
Please Donate...
     
Related Topics...
Thread Thread Starter Forum Replies Last Post
Is an Option Button Selected? HotRod Information Technology 7 28-Jul-2006 08:30 AM
How do I display a number in a field when I click on a button. Jarrod Information Technology 2 28-Jul-2006 08:29 AM
Using Acces or Excel How Can I create a Raido Button or Something to Click on to Dial a Phone Number? Mike Information Technology 2 28-Jul-2006 08:26 AM
"On Click" from Button won't run code in Access 2007 (2000 db) st Information Technology 2 28-Jul-2006 08:25 AM
VBA--click a button to open a TABLE and only show conditioned records ? Martin Information Technology 2 29-Oct-2005 12:35 PM


Tags
automatically, put, label, click, option, button
Reply Post New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!
  #1 (permalink)  
Old 05-Nov-2005, 12:48 PM
Last user''''s name that modified a reco's Avatar Last user''''s name that modified a reco
Guest
 
Posts: n/a
   
   
how to automatically put a label when i click an option button?

  Donate Today!   Email to Friend  Tell a Friend   Show Printable Version  Print   Contact sikhphilosophy.net Administraion for any Suggestions, Ideas, Feedback.  Feedback  

Register to Remove Advertisements
hi. greetings!

i have an employee database and i have an option group called "Employee
Status" and a label called lblStatus. Now, what I want to do is to display
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/6694-how-automatically-put-label-when-i.html
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6694
into the lblStatus the option I selected from the option group. For example,
when I select "AWOL" from the option group, lblStatus should display "AWOL".
Please help me.

Thank you very much!

Resty

*







Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-Nov-2005, 12:48 PM
Sprinks's Avatar Sprinks
Guest
 
Posts: n/a
   
   
RE: how to automatically put a label when i click an option button?

Hi.

Set the Label's caption property in the Option Group's AfterUpdate and the
Form's OnCurrent events. Note that the value of the option group is
different than the label of the selected option.

Select Case Me![YourOptionGroup]
Case 1
Me![YourLabel].Caption = "AWOL"
Case 2
Me![YourLabel].Caption = "SomeOtherValue"
' Place other cases here
Case Else
Me![YourLabel].Caption = ""
End Select

Hope that helps.
Sprinks
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6694
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6694

"Last user''''s name that modified a reco" wrote:

> hi. greetings!
>
> i have an employee database and i have an option group called "Employee
> Status" and a label called lblStatus. Now, what I want to do is to display
> into the lblStatus the option I selected from the option group. For example,
> when I select "AWOL" from the option group, lblStatus should display "AWOL".
> Please help me.
>
> Thank you very much!
>
> Resty

Reply With Quote
  #3 (permalink)  
Old 05-Nov-2005, 12:48 PM
WhyIsDoug's Avatar WhyIsDoug
Guest
 
Posts: n/a
   
   
RE: how to automatically put a label when i click an option button?

As with anything else in VBA/Access there are several ways to accomplish
this. I always prefer to make the code as dynamic as possible so anytime I
can make the code figure it out without me altering it when I add new options
that's what I would do.

In that vain I would suggest that you add the Status ("AWOL" in your
example) to the Tag property of the Option Button when you add the control to
the Option Groug. Then you can simply loop through the Controls collection of
the Option Group looking for OptionButton controls. Test there OptionValue
property against that of the OptionGroup and then set the Caption of your
Status Label to the Tag property of the Option Button selected.

Here's an example:

Private Sub opgStatus_AfterUpdate()
Dim ctl As Control

For Each ctl In opgStatus.Controls
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6694
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6694
If TypeOf ctl Is OptionButton Then
If Me.opgStatus.Value = ctl.OptionValue Then
Me.lblStatus.Caption = ctl.Tag
Exit For
End If
End If
Next opbButton

Set ctl = Nothing

End Sub

As you can see, you can now simply add OptionsButton's to the OptionGroup,
put the Status you want in the Tag property of the OptionButton and the code
will continue to work without modification.

This would work well (or even better) if you used a table of status' to
dynamically build the OptionGroup using the Status ID as the OptionValue. Of
course if you reach this point, a different control (such as a ListBox or
ComboBox) would probably work better.

If this answered your question please respond accordingly when asked. THis
will mark it as an answer and allow others to find it more easily.
--
WhyIsDoug?


"Last user''''s name that modified a reco" wrote:

> hi. greetings!
>
> i have an employee database and i have an option group called "Employee
> Status" and a label called lblStatus. Now, what I want to do is to display
> into the lblStatus the option I selected from the option group. For example,
> when I select "AWOL" from the option group, lblStatus should display "AWOL".
> Please help me.
>
> Thank you very much!
>
> Resty

Reply With Quote
  #4 (permalink)  
Old 05-Nov-2005, 12:48 PM
Last user''''s name that modified a reco's Avatar Last user''''s name that modified a reco
Guest
 
Posts: n/a
   
   
RE: how to automatically put a label when i click an option button

  Donate Today!  
hi, Sprinks!

Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6694
Your code worked well. Thank you so much, dude!

Resty

"Sprinks" wrote:

> Hi.
>
> Set the Label's caption property in the Option Group's AfterUpdate and the
> Form's OnCurrent events. Note that the value of the option group is
> different than the label of the selected option.
>
> Select Case Me![YourOptionGroup]
> Case 1
> Me![YourLabel].Caption = "AWOL"
> Case 2
> Me![YourLabel].Caption = "SomeOtherValue"
> ' Place other cases here
> Case Else
> Me![YourLabel].Caption = ""
> End Select
>
> Hope that helps.
> Sprinks
>
> "Last user''''s name that modified a reco" wrote:
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=6694
>
> > hi. greetings!
> >
> > i have an employee database and i have an option group called "Employee
> > Status" and a label called lblStatus. Now, what I want to do is to display
> > into the lblStatus the option I selected from the option group. For example,
> > when I select "AWOL" from the option group, lblStatus should display "AWOL".
> > Please help me.
> >
> > Thank you very much!
> >
> > Resty

Reply With Quote
   Click Here to Donate Now!

Support Us!
Become a Promoter!
Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh!
ReplyPost New Topic In This Forum Stay Connected to Sikhism, Click Here to Register Now!

Bookmarks


(View-All Members who have read this thread : 0
There are no names to display.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Tools Search
Search:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

» Active Discussions
How does Sikhi help you...
Today 18:56 PM
27 Replies, 922 Views
Keeping Amrit Vela
Today 16:49 PM
12 Replies, 907 Views
Do you believe in...
Today 15:08 PM
196 Replies, 4,083 Views
Occultism - Rejection in...
Today 14:04 PM
59 Replies, 2,587 Views
Panjabi
By Ishna
Today 13:43 PM
14 Replies, 287 Views
Black Sikhs?
Today 06:33 AM
20 Replies, 5,816 Views
Man Driving Without...
Today 05:06 AM
5 Replies, 139 Views
Request for assistance...
Today 04:24 AM
8 Replies, 90 Views
Losing My Religion: Why...
Today 03:03 AM
13 Replies, 350 Views
Health Exercise And...
Today 02:10 AM
1 Replies, 93 Views
Sikh Spokesman (ਪੰਜਾਬੀ...
Today 02:10 AM
176 Replies, 4,513 Views
How Religions Change...
Today 02:07 AM
1 Replies, 108 Views
Rozana Reports (ਪੰਜਾਬੀ...
Today 01:52 AM
313 Replies, 7,603 Views
Parkash Guru Amar Das ji...
Yesterday 17:07 PM
3 Replies, 87 Views
Serious challenges to...
Yesterday 16:49 PM
0 Replies, 160 Views
» Books You Should Read...
Powered by vBadvanced CMPS v3.2.3
All times are GMT +6.5. The time now is 19:46 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2 Copyright © 2004-12, All Rights Reserved. Sikh Philosophy Network


Page generated in 0.47526 seconds with 32 queries
0