Displaying an instance of a form

  • Thread starter Thread starter Mota
  • Start date Start date
M

Mota

Hello;
In a from named "RequestFRM",i want to show another copy of a form ,just
with its recordset changed.I used this syntax:
Dim Frm as form,DB as dataBase
Set DB=DBEngine(0)(0)
Set Frm=New Form_RequestFRM
Frm.RecordSource=DB!QueryDefs!RequestQRY
Frm.Visible=True
Frm.SetFocus

But this cant show the second form.I changed PopUp property of the form,but
still doesnt work.How to do this?
any feed back wd be appreciated.Thank you.
 
Mota said:
In a from named "RequestFRM",i want to show another copy of a form ,just
with its recordset changed.I used this syntax:
Dim Frm as form,DB as dataBase
Set DB=DBEngine(0)(0)
Set Frm=New Form_RequestFRM
Frm.RecordSource=DB!QueryDefs!RequestQRY
Frm.Visible=True
Frm.SetFocus

But this cant show the second form.I changed PopUp property of the form,but
still doesnt work.


I don't think you can set a record source to a QueryDef, it
should be either the name of the QueryDef or its SQL string.
Try one of these:

Frm.RecordSource="RequestQRY"
or
Frm.RecordSource=DB!QueryDefs!RequestQRY.SQL

You don't show enough of your code for me to tell, but you
do have to make sure the the form object reference does not
go out of scope until the form is closed.
 
Yes;
Problem was that this code was attached to a command button,and sure its
life overs at end of Sub.And i was not aware of that.
I have to say a special thanx to you,for solving many of my problems by
replying to my posts in the few last days.Thank you for all your helps.
 
If you only open one additional instance of the form, you
can declare Frm as a module level object variable. If the
first instance of the form won't be closed until after the
second instance is closed then the declaration can be in the
forms module. If the second instance might stay open after
the first one is closed then declare FRM in a standard
module.

If you're going to have an arbitrary number of instances of
the form open at a time, then you will need a global array
or, usually best, a collection to hold the form objects of
all the open instances (sort of your own version of the
Forms collection).

Keep after this stuff, you're making great progress.
 
Back
Top