P
Peter Hibbs
Access 2000/3/7.
I am using the following code to populate a combo box with a list of
all the forms in the database.
In a Module :-
'-------------------------------------------------------------------------------
Public Function GetList() As String
'Returns list of database form objects as a string
Dim obj As AccessObject, db As Object
Set db = Application.CurrentProject
For Each obj In db.AllForms
GetList = GetList & obj.Name & ";"
Next obj
db.Close
Set db = Nothing
'Strip off last ; if any form names present
If Len(GetList) > 0 Then GetList = Left(GetList, Len(GetList) - 1)
End Function
'-------------------------------------------------------------------------------
And in the form code :-
Me.cboObject.RowSource = GetList()
which works fine.
First problem-
I would like to ONLY return forms which are NOT sub-forms on another
form. The obj.Type parameter seems to return value 2 for all forms. Is
there any way to determine if a form is a sub-form or not (Access must
know!).
Second problem-
The list returns the form names as a random list, is there any simple
method to sort the form names in alphabetical order (short of creating
a temporary table and binding that to a query).
TIA
Peter Hibbs.
I am using the following code to populate a combo box with a list of
all the forms in the database.
In a Module :-
'-------------------------------------------------------------------------------
Public Function GetList() As String
'Returns list of database form objects as a string
Dim obj As AccessObject, db As Object
Set db = Application.CurrentProject
For Each obj In db.AllForms
GetList = GetList & obj.Name & ";"
Next obj
db.Close
Set db = Nothing
'Strip off last ; if any form names present
If Len(GetList) > 0 Then GetList = Left(GetList, Len(GetList) - 1)
End Function
'-------------------------------------------------------------------------------
And in the form code :-
Me.cboObject.RowSource = GetList()
which works fine.
First problem-
I would like to ONLY return forms which are NOT sub-forms on another
form. The obj.Type parameter seems to return value 2 for all forms. Is
there any way to determine if a form is a sub-form or not (Access must
know!).
Second problem-
The list returns the form names as a random list, is there any simple
method to sort the form names in alphabetical order (short of creating
a temporary table and binding that to a query).
TIA
Peter Hibbs.