[AccessD] Question about SubForms

Gustav Brock Gustav at cactus.dk
Tue Dec 28 14:13:47 CST 2004


Hi Arthur

This works here:

Private Sub Form_Open(Cancel As Integer)

  If IsSubform() Then
    Me.Section(acHeader).Visible = False
  End If

End Sub

However, I don't test for Me.Parent:

Private Function IsSubform() As Boolean

  Static booSubform     As Boolean
  Static lngFormsCount  As Long

  If lngFormsCount = 0 Then
    lngFormsCount = Forms.Count
    booSubform = StrComp(Forms(lngFormsCount - 1).Name, Me.Name,
vbTextCompare)
  End If

  IsSubform = booSubform
      
End Function

/gustav

>>> artful at rogers.com 28-12-2004 20:46:27 >>>
I have a tabbed form on which each tab contains a subform. One of these

subforms can also be opened independently. It contains a form header 
which contains a "finder" (i.e. combo-box that does the find-thing). 
When it's opened as an independent form, I want the header to show, but

when opened as a sub-form I want it to be hidden.

Unsure of the syntax here. My OnOpen code simply says (so far)

If IsSubForm(Me) Then
    ' various failed attempts go here
End If

The function IsOpen() is pretty much standard. Check the form's 
parent.name attribute. But I am unsure how to hide the header given a 
True response from IsSubForm().

TIA,
Arthur




More information about the AccessD mailing list