Iqbal.bhroochi
New Member
- Joined
- May 10, 2008
- Messages
- 6
I have two user forms named "Userform1" and "Userform2". In Userform1, I have two Command Buttons named "cmd1" and "cmd2" and in Userform2 I have Listbox1. My problem is that When I click on cmd1 on Userform1, Userform2 displays listbox1 with correct rowsource property but when I click on cmd2, first time userform2 displays previous rowsource property then I close the Userform2 then click again on cmd2 userform2 shows correct rowsource perperty.
Where is the problem. What's wrong with my code.
Here is my code:
Private Sub cmd1_Click()
UserForm2.Show
UserForm2.ListBox1.RowSource = "Group_A"
End Sub
Private Sub cmd2_Click()
UserForm2.Show
UserForm2.ListBox1.RowSource = "Group_B"
End Sub
Private Sub UserForm_Activate()
UserForm2.ListBox1.RowSource = "Group_A"
End Sub
Private Sub UserForm_Deactivate()
UserForm2.ListBox1.RowSource = ""
End Sub
Please help me.
Where is the problem. What's wrong with my code.
Here is my code:
Private Sub cmd1_Click()
UserForm2.Show
UserForm2.ListBox1.RowSource = "Group_A"
End Sub
Private Sub cmd2_Click()
UserForm2.Show
UserForm2.ListBox1.RowSource = "Group_B"
End Sub
Private Sub UserForm_Activate()
UserForm2.ListBox1.RowSource = "Group_A"
End Sub
Private Sub UserForm_Deactivate()
UserForm2.ListBox1.RowSource = ""
End Sub
Please help me.