Not the good Form_Activate

Hi,
  I have many forms in my pgm.
I have these three :
frmFacture
frmChoix
frmDblCli

Here is my problem:
In frmFacture, i call frmChoix and frmChoix call frmDblCli like this:

FrmChoix.Show 1
FrmDbLCli.Show 1

When i do F8 all works all right, but when i do F5 the Form_Activate of FrmDbLCli doesn't work it is Form_Activate of frmFacture that is  working, it doesn't make any sense.

Why and what to do?
Someone have an idea?
LVL 1
dosylAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rovermCommented:
Try this:

FrmChoix.Show 1
DoEvents
FrmDbLCli.Show 1
DoEvents

So that VB handles all well !



0
tkuppinenCommented:
If a form is hidden instead of unloaded then it will not have a load event.
0
dosylAuthor Commented:
roverm, itried DoEvents after to call Form like you writed and it doesn't work.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

tkuppinenCommented:
Do you hide or unload your forms?
0
dosylAuthor Commented:
tkuppinen , it doesn't work not more.
0
dosylAuthor Commented:
I hide frmChoix and frmDblCli.
0
rovermCommented:
Okay: this is what I tested:
in form1:

Private Sub Form_Load()
  Form2.Hide
  Form3.Hide
End Sub

Private Sub Command1_Click()
  Form2.Show 1
  Form3.Show 1
End Sub

where Command1 activates the other forms

in forms 2 and 3:

Private Sub Command1_Click()
  Me.Hide
End Sub

where command1 is a 'close form' button

This works fine !!!!!

Hope is does to when you try it !

;-) RoverM
0
dosylAuthor Commented:
My code is:
frmFacture->
Private Sub GrilleFact_CellButtonClick(Row As Long, Col As Long)
FrmChoix.Show 1
End Sub
frmChoix->
Private Sub ListChoix_DblClick()
Me.Hide
Set FrmChoix = Nothing
End Sub
frmDblCli->
Private Sub DBListCli_DblClick()
Me.Hide
Set FrmDbLCli = Nothing
End Sub
0
dosylAuthor Commented:
Hi, i found my error. It was because i hided my Form and i had others instructions after. Not logical.

I'll give the points to the first person that answer to this question :
When we hide a Form is it good to set the form to Nothing like this :
Me.Hide
Set FrmDbLCli = Nothing

0
freelnceCommented:
This is straight out of the VB On-line help:

When Show displays a modal form, no input (keyboard or mouse click) can occur except to objects on the modal form. The program must hide or unload a modal form (usually in response to some user action) before input to another form can occur. An MDIForm can't be modal.

Although other forms in your application are disabled when a modal form is displayed, other applications aren't.


As for your question on setting a hidden form to nothing: why would you want to do that?  If you set it to nothing without unloading the form then it does nothing with the form to free up any resources used by the form nor does it dereference the form itself.

In a new project module type the following example:


Public Sub Main()
   Form1.Show
   Form1.Hide
   Set Form1 = Nothing
   MsgBox ("Form Name = " & Form1.Name), vbOKOnly, "Form Name"
End Sub


When this  code runs you will still see the form name showing that the form is still referenced and it's used resources are intact.
0
dosylAuthor Commented:
Scuse, it is not clear for me. Do we put Set Form2=Nothing when we HIDE it; YES OR NO?
0
freelnceCommented:
freelnce changed the proposed answer to a comment
0
freelnceCommented:
Hello again dosyl,

No,  setting a form to nothing when you hide it is not necessary. It does not release any reosurces in use.  you only need to set the form to nothing if you are unloading it from memory:

UNLOAD FORM2
SET FORM2 = NOTHING
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dosylAuthor Commented:
If someone  wants to see how i debug my pgm. for the form_Activate go to see: Please debug my pgm.(Question).
Now, freeInce thank's for your answer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.