rename Label based on option box text value (1 Viewer)

nardimrk

Registered User.
Local time
Today, 04:56
Joined
May 13, 2018
Messages
13
Hi Everyone,

I'm a new member ;) I've found this forum while looking for good training videos on access vba.
I was wondering if someone can help tell me how to change a text label based on option box selection.

i.e. if "particolare a disegno" = true
then eti_tipo_art.caption = "particolare a disegno"...

:banghead:



thanks!
 

June7

AWF VIP
Local time
Today, 03:56
Joined
Mar 9, 2014
Messages
5,423
Options:

1. VBA sets the label Caption property, the real trick is figuring out what event to put code in

2. Use a textbox as a 'label' with conditional expression in ControlSource
 
Last edited by a moderator:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:56
Joined
May 7, 2009
Messages
19,169
use the Option box control name and not the Label associated with it.
Do it in the AfterUpdate event of the option control:

Eg:


Private sub option1_aftetupdate()
If me.option1 then
eti_tipo_art.caption = "particolare a disegno"
Else
eti_tipo_art.caption = "What to put"
End if
End sub

You can also use the Option Group Value. The value of which is 1 to number of oPtion buttons.


Private sub optionGrp_aftetupdate()
If optionGrp.Value =1 then
eti_tipo_art.caption = "particolare a disegno"
ElseIf optionGrp.Value =2 Then
'...
End If
 
Last edited:

Users who are viewing this thread

Top Bottom