I don't like loops and loops do not like me

xPaul

Registered User.
Local time
Today, 00:20
Joined
Jan 27, 2013
Messages
65
Hi all,

I am having a problem with parsing the array value to Froms!<arraryvaluehere>.dirty.

Please see the code below:

Code:
Public strListOfForms(0 To 2) As String

strListOfForms(0) = "frmForm1"
strListOfForms(1) = "frmForm2"
strListOfForms(2) = "frmForm3"

For i = 0 To 2

Debug.Print CurrentProject.AllForms(strListOfForms(i)).IsLoaded
Debug.Print Forms!strListOfForms(i).Dirty

Next i

Note: CurrentProject.AllForms(strListOfForms(i)).IsLoaded works and Forms!strListOfForms(i).Dirty does not.

Is this because it is taking "strListOfForms(i)" literally? Is there a way that I can get around this?

Best regads all

xPaul
 
Try Forms(strListOfForms(i)).Dirty

Code:
Public strListOfForms(0 To 2) As String
strListOfForms(0) = "frmForm1"
strListOfForms(1) = "frmForm2"
strListOfForms(2) = "frmForm3"

For i = 0 To 2
    Debug.Print CurrentProject.AllForms(strListOfForms(i)).IsLoaded
    Debug.Print Forms[B](strListOfForms(i))[/B].Dirty
Next i
 

Users who are viewing this thread

Back
Top Bottom