Disapearing Form...

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

Guest

I have a form with a subform on it.
From the subform i have a feild that's click event is set to the code below.
The problem is the form displays for 1n-th of a second or a blink on the
screen then disapears. I've tried looking in the Window unhide like the book
i'm using says but there is nothing listed under that. It's like the form is
killing itself.

Any help would be appreaciated very very much!

Thanks
Mike
S


Public Sub Multiples2()
Dim CollectForms As New Collection
Dim selCurrentShopOrder As String
Dim frm As Form

selCurrentShopOrder =
Forms![frmWIPExplorer].sfmSONumbersLarge.Form.strShopOrderNumber

Set frm = New Form_frmSOInformation
CollectForms.Add frm
With frm
'.Filter = "strShopOrderNumber = " & selCurrentShopOrder
.FilterOn = True
.Caption = "Shop Order Number " & selCurrentShopOrder
.Visible = True
End With
'MsgBox selCurrentShopOrder
End Sub
 
UPDATED Code


Public Sub Multiples2()
Dim CollectForms As New Collection
Dim selCurrentShopOrder As String
Dim frm As Form

selCurrentShopOrder =
Forms![frmWIPExplorer].sfmSONumbersLarge.Form.strShopOrderNumber
MsgBox selCurrentShopOrder
Set frm = New Form_frmSOInformation
CollectForms.Add frm
With frm
.Filter = "strShopOrderNumber = " & selCurrentShopOrder
.FilterOn = True
.Caption = "Shop Order Number " & selCurrentShopOrder
.Visible = True
End With

'MsgBox selCurrentShopOrder
End Sub
 
yooper_ssm said:
I have a form with a subform on it.
From the subform i have a feild that's click event is set to the code
below. The problem is the form displays for 1n-th of a second or a
blink on the screen then disapears. I've tried looking in the Window
unhide like the book i'm using says but there is nothing listed under
that. It's like the form is killing itself.

Any help would be appreaciated very very much!

Thanks
Mike
S


Public Sub Multiples2()
Dim CollectForms As New Collection
Dim selCurrentShopOrder As String
Dim frm As Form

selCurrentShopOrder =
Forms![frmWIPExplorer].sfmSONumbersLarge.Form.strShopOrderNumber

Set frm = New Form_frmSOInformation
CollectForms.Add frm
With frm
'.Filter = "strShopOrderNumber = " & selCurrentShopOrder
.FilterOn = True
.Caption = "Shop Order Number " & selCurrentShopOrder
.Visible = True
End With
'MsgBox selCurrentShopOrder
End Sub

Your collection, CollectForms, is defined inside the sub Multiples2.
That means that it will be destroyed when that sub exits, as the
collection variable goes out of scope. So, with both frm and
CollectForms destroyed, there is no reference to the form object, and
the form object is destroyed.

Define CollectForms at module level in a standard module, or at least in
some module that will remain in existence until you're done working with
the forms you insert in the collection.
 
THANK you very much
that makes sense changed the code around and voila it works great.

Mike
S
 
Back
Top