Jul 5, 2005 #1 dolfin13 Programmer Jun 29, 2005 22 US How would I refer to the caption of a button that was just clicked? I would like to set a variable to the caption of cmd button in the click event of said button. Thanks in advance, my mind is in the wrong place today.
How would I refer to the caption of a button that was just clicked? I would like to set a variable to the caption of cmd button in the click event of said button. Thanks in advance, my mind is in the wrong place today.
Jul 5, 2005 #2 PHV MIS Nov 8, 2002 53,708 FR Something like this ? Me![command button name].Caption = "You've clicked me !" Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886 Upvote 0 Downvote
Something like this ? Me![command button name].Caption = "You've clicked me !" Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
Jul 5, 2005 1 #3 Eupher MIS Jul 18, 2002 1,724 US Or this: Code: Dim MyVar As String MyVar = Me!MyButton.Caption Ken S. Upvote 0 Downvote
Jul 5, 2005 Thread starter #4 dolfin13 Programmer Jun 29, 2005 22 US sort of... but I have many buttons, and wondered if there is a way to refer to the that was just clicked. Private Sub cmdButton_Click() Dim strCaption As String strCaption = Me.[button that was just pressed].Caption is there a way to do this? Thanks for the quick reply, I'm sorry if I'm being confusing. Upvote 0 Downvote
sort of... but I have many buttons, and wondered if there is a way to refer to the that was just clicked. Private Sub cmdButton_Click() Dim strCaption As String strCaption = Me.[button that was just pressed].Caption is there a way to do this? Thanks for the quick reply, I'm sorry if I'm being confusing.
Jul 5, 2005 #5 PHV MIS Nov 8, 2002 53,708 FR OOps, my lack of english language knowledge ... Upvote 0 Downvote
Jul 5, 2005 #6 Eupher MIS Jul 18, 2002 1,724 US Try this: Code: Dim ctrl As Control Dim strCaption As String Set ctrl = Screen.ActiveControl strCaption = ctrl.Caption Ken S. Upvote 0 Downvote
Try this: Code: Dim ctrl As Control Dim strCaption As String Set ctrl = Screen.ActiveControl strCaption = ctrl.Caption Ken S.
Jul 5, 2005 Thread starter #7 dolfin13 Programmer Jun 29, 2005 22 US That's what I'm looking for! Thanks a million!!! Upvote 0 Downvote