This will fill a listbox (lstFormList) with all the form names:
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Handler
Dim db As Database
Dim i As Integer
Dim contr As Container
Dim strFormList As String
Dim StrFormName As String
Dim Length As Integer
Set db = CurrentDb()
Set contr = db.Containers("Forms")
strFormList = ""
For i = 0 To contr.Documents.Count - 1
StrFormName = contr.Documents(i).name
If strFormList <> "" Then strFormList = strFormList & ";"
Length = Len(StrFormName)
strFormList = strFormList & StrFormName
Next i
Arvin, what does one do to get form object references,
either instead of strings or by converting strings ?
(I thought that maybe it would be contr.Documents(i), but it is not.)
Right. In my immediate case, open form also is required by the operations
that demand object reference.
I imagine that some operations that demand object reference may not require
open form, in which case I would prefer to provide a form reference that does
not depend on open state. What would be the reference syntax then?
Right. In my immediate case, open form also is required by the operations
that demand object reference.
I imagine that some operations that demand object reference may not
require
open form, in which case I would prefer to provide a form reference that
does
not depend on open state. What would be the reference syntax then?
If by "form reference", you mean you want to be able to work with objects on
the form, there is no other way but to open the form and refer to it using
the syntax you've already determine.
If all you're trying to do is get the list of forms, Arvin's shown you how.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.