Guys,

I have a question, is there any way in code to determine if a button has been clicked? I want to use one form when a control button on a second form is click; I do not know how to do that, though I know it goes something like this :

if UserForm1.CommandButton. <I do not know what goes in here  >  = true Then
 
endif

Please can somebody help me out? Thank you very much.

Ini

Hi

Are you trying to open up a different form - let's say form2 - from the click on a button on form1?

why don't you use the event created by the button? and then open up the form.

something like this:

Private Sub button1_Click() 

     form2.show
    
End Sub

where button1 is the name of the button in form 1.

hope it helps

I have form A that has 4 control buttons(A,B,C,and D), I have Form B which will be called up when each of these 4 buttons are pressed. I want when control A is pressed, it will open Form B with Form B title saying "A". If Control Button B is press, Form B will Open up with its label saying "B" and so on.

I hope this helps make my problem easier to answer. I am trying to use the same form for 4 different things.

INI


No, I am trying to determine if the control button on Form 1 was clicked. If

Ah, ok

this is the code for the four buttons on formA

Private Sub Command1_Click()
Form2.Show
Form2.Label1.Caption = "A"
End Sub

Private Sub Command2_Click()
Form2.Show
Form2.Label1.Caption = "B"
End Sub

Private Sub Command3_Click()
Form2.Show
Form2.Label1.Caption = "C"
End Sub

Private Sub Command4_Click()
Form2.Show
Form2.Label1.Caption = "D"
End Sub

where Command1, Command2, Command3 and Command4 are the buttons, and label1 in form2 will change everytime you hit a button

This article has been dead for over six months. Start a new discussion instead.