New to Form Class Modules (Subform)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a main form. It has a button that is intended to Open a subform. I
am instantiating the subform in the Form_Current of the main form as follows:
Set oFullName = New Form_frm_UCheckFullName
(I've declared the object in the general declarations section as
Private oFullName As Form_frm_UCheckFullName though I've tried it as Dim).

The way it works is that I press the button and it works.
If I change records (execute Form_Current), it works also.

But if I click the button again after successfully seeing subform the first
time, I get an error that says that the object is closed or does not exist.

Thus, the oFullName object must be going out of scope. But why? And how can
I prevent this. I believe my declarations are in the wrong place, but, I
must be close.

Any suggestions?
 
Nevermind.
The answer was that it goes in the Sub butFullName_Click().
I had tried it there previously, but the problem before was that oFullName
was not correctly dimensioned in general declarations.
 
Back
Top