Referencing active label

latex88

Registered User.
Local time
Today, 11:38
Joined
Jul 10, 2003
Messages
198
Since you cannot change the the color or other attributes of command buttons, I've decided to make labels to look like buttons, as some have suggested. When you press a button, you can reference it by Me.ActiveControl...

It does not seem to work for labels. What is the similar code to reference a label being clicked?
 
Labels have a Click event, so you can code that just as you would a command button Click event.
 
Since you cannot change the the color or other attributes of command buttons, I've decided to make labels to look like buttons, as some have suggested. When you press a button, you can reference it by Me.ActiveControl...

It does not seem to work for labels. What is the similar code to reference a label being clicked?

Access 2010 does allow you to change button colors.
 
Labels have a Click event, so you can code that just as you would a command button Click event.

Hi Sean,
The thing is that I want to create a bunch of these button made out of labels. I want to use a generic code in their click event. Recall you helping me out on extracting the caption of the button before? The code below worked beautifully for command buttons, but with a label, I receive this error message (The expression you entered requires the control to be in the active window). Therefore, I presume I cannot use "ActiveControl" on a label.

Code:
Variable = Left(Me.ActiveControl.Caption, InStr(1, Me.ActiveControl.Caption, Chr(13)) - 1)
 
Access 2010 does allow you to change button colors.

I tried earlier but I failed, so I started to research only to see a bunch of comments that you cannot. Apparently my code was no good before. I just tried it again, and I do see it's possible. Thanks.
 
I tried earlier but I failed, so I started to research only to see a bunch of comments that you cannot. Apparently my code was no good before. I just tried it again, and I do see it's possible. Thanks.

See Screen Shot Attachment.
 

Attachments

Users who are viewing this thread

Back
Top Bottom