B
Bob Bridges
I first tackled VBA/Access a few years ago when I wrote a Contacts
database...but I did it alone and I'm pretty sure I'm doing some things the
hard way, so feel free to challenge me on more than just this question.
I think I'm about ready to learn how to open up a form more than once --
that is, how to use "instances" of forms, or to open "non-default" instances
of them. Up 'til now, I've done it like this:
DoCmd.OpenForm "clCoSub"
DoCmd.Requery
That code is connected to a button on a record in the master form, and it
gets me the subform with the right child records in them. The problem is
that if I then click the same button on a different record, it doesn't get me
a new instance of the subform, it just replaces the data in the same form
with new records.
I read that I can open up a new form like this:
Set x = New Form_clCoSub
x.Visible=True
This new form disappears as soon as the button-Click module has finished
executing, but by declaring a Collection object at the Module level and
saving the new form object in the collection, I can get it to hang around.
And some of the controls in the form aren't correctly populated with data
when I use this method, but I'm sure I can populated them manually in the
code. What I'm trying to figure out right now is why Access insists on
asking me, at the time it's bringing up the form, to fill in the value of a
checkbox on the form as it's getting ready to open it.
Can anyone point me to a good technical article about non-default instances
of forms so I can learn some of the things I've been only guessing at until
now?
database...but I did it alone and I'm pretty sure I'm doing some things the
hard way, so feel free to challenge me on more than just this question.
I think I'm about ready to learn how to open up a form more than once --
that is, how to use "instances" of forms, or to open "non-default" instances
of them. Up 'til now, I've done it like this:
DoCmd.OpenForm "clCoSub"
DoCmd.Requery
That code is connected to a button on a record in the master form, and it
gets me the subform with the right child records in them. The problem is
that if I then click the same button on a different record, it doesn't get me
a new instance of the subform, it just replaces the data in the same form
with new records.
I read that I can open up a new form like this:
Set x = New Form_clCoSub
x.Visible=True
This new form disappears as soon as the button-Click module has finished
executing, but by declaring a Collection object at the Module level and
saving the new form object in the collection, I can get it to hang around.
And some of the controls in the form aren't correctly populated with data
when I use this method, but I'm sure I can populated them manually in the
code. What I'm trying to figure out right now is why Access insists on
asking me, at the time it's bringing up the form, to fill in the value of a
checkbox on the form as it's getting ready to open it.
Can anyone point me to a good technical article about non-default instances
of forms so I can learn some of the things I've been only guessing at until
now?