PDA

View Full Version : Sleeper: Switch Form



sheeeng
07-03-2005, 09:23 PM
hi all, :hi:

I'm facing lots of errors when closing main form and show other form..:banghead: :banghead:

I have 4 form

UserForm1, UserForm2, UserForm3, UserForm4
All other 3 forms is linked to UserForm1.

1. But after I show and closed UserForm2 a few time, it cannot close by the upright buttons after showing it the second time.
2. when I closed one of the other 3 form, userform1 should appear..
3. but when i show again the other 3 form, every data in the form's textbox was gone...:banghead:

Also may I know how to terminate a form completely out of memory?
And call them again with a fresh copy thorugh userform1?

Please help.... :banghead:

File attached....

Jacob Hilderbrand
07-03-2005, 10:26 PM
To terminate a form completely, you Unload it (Unload UserForm1 or Unload Me). This may be your problem since you are unloading Userform1. Do not unload UserForm1 if you want it to be there when you close the other userforms.

Also you cannot hide the userform when it is being closed. You can do something like this though.




Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
Me.Hide
End If
End Sub

sheeeng
07-03-2005, 10:28 PM
Thx, Jake.

But I'm still facing errors....
Error msg below...
The second time that I opened UserForm2, it cannot be closed...:banghead:
Please help...:friends:

Where does CloseMode and Cancel takes value from?

Thx

Justinlabenne
07-04-2005, 12:32 AM
If it's not outside your projects scope, maybe setting the form's modal property to "False" can help to alleviate some of your pain. Just put "False" behind all like:


Userform#.Show False


Plus using DRJ's code,


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
Me.Hide
End If
UserForm1.Show False
End Sub



See Attached:

sheeeng
07-04-2005, 12:49 AM
Userform#.Show False


What is the difference between Modal and Modeless Form? :banghead:
What will the "false" do?:banghead:

Thx :friends: