Hi,

I have a dilema, I have an MDI app and I open new forms as

In modBas.bas:

    Public frmD(50) As frmDocument

MDI Form Load (frmMain):

    Static lDocumentCount As Long
    lDocumentCount = lDocumentCount + 1
    Set frmD(1) = New frmDocument
    frmD(1).Width = 320 * Screen.TwipsPerPixelX
    frmD(1).Caption = "Page - Home (" & lDocumentCount & ")"
    frmD(1).Show
    lDocumentCount = lDocumentCount + 1
    Set frmD(2) = New frmDocument
    frmD(2).Width = 320 * Screen.TwipsPerPixelX
    frmD(2).Caption = "Page - About (" & lDocumentCount & ")"
    frmD(2).Show

I can refer to each form as

frmD(Index).SetFocus
frmD(Index).Show

etc. no problem.

However I cannot read this name from the form, when I read the name:

strFrmName = ActiveForm.Name

I simply get frmDocument (the template document name)

How can I read the frmD(Index) name of the Active Document?

Tried everything I can think of, help much appreaciated.

Steve

"If all you own is a hammer, every problem starts looking like a nail."

Not sure what you mean by "form name". The Name attribute for every child form of the same type will be the same.

One possibility if you're looking for a way to identify the forms is to use the frmD(Index).Tag property and populate it with something useful when you instantiate it. Or, if you're using .Tag for something else, you can always create a hidden textbox control and use that for the same purpose.

Comments
Good answer

Not sure what you mean by "form name". The Name attribute for every child form of the same type will be the same.

One possibility if you're looking for a way to identify the forms is to use the frmD(Index).Tag property and populate it with something useful when you instantiate it. Or, if you're using .Tag for something else, you can always create a hidden textbox control and use that for the same purpose.

The Tag option seems to be the solution. Thanks for that.

The Tag option seems to be the solution. Thanks for that.

For some reason assigning a tag to each frmD(n) doesn't work, so have used your second option, a hidden, disabled,locked label, and that does work, so thanks again.

This question has already been answered. Start a new discussion instead.