Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form index (form number)

Status
Not open for further replies.

kingraoul

Technical User
Feb 21, 2003
15
IT
Hi, it seems strange, but i cannot recall (and cannot find in the docs) how to retrieve the index(number) of a form to later addressing a form with his ID/Index/number or whatever name you want to use. It's late tonight here and i can only think i'm veeeery sleepy. :)

Thank you very much.
 
Using the form index is not very useful...In this case, the index is variable - depending on the order of opening forms, so you'd better refere it by name:

Forms![YourFormName]
or
Forms("YourFormName")
The latter is my favourite, as it allows using a string variable:

strFormName = "MyForm"
Set frm = Forms(strFormName)

As for getting the index knowing the name:

Sub listopenforms()
Dim i As Long
For i = 0 To Forms.Count - 1
Debug.Print Forms(i).Name
'You can store the name and index in an array
'but if you close or open a form, the collection changes
'so I think it's useless
Next
End Sub

Good luck



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top