From: Lord Kelvan on
On furthering on my question from yesterday I just want to know how
this collection is formed.

Logic demands that form.item(0) would be the first form opened then if
you open another form form.item(1) would be the ID of that form and if
you opened another form from the that forms id would be form.item(2)
then if you closed form.item(2) you would go back to the second opened
form form.item(1)

So based on this form.item(form.count-1) will always target the last
form opened. Is this correct or does this collection mess itself up
and this is not the case.

Regards
Kelvan
From: Arvin Meyer [MVP] on
I don't think you have it quite right, but maybe I'm misunderstanding:

The Item property is not a form property, it is a property of the forms
collection, so:

form.item(form.count-1)

should really be:

forms.item(forms.count).Visible

which is refering to each item in the forms collection

Forms.Count is normally used like:

For i = 0 To Forms.Count - 1
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access
Co-author: "Access 2010 Solutions", published by Wiley



"Lord Kelvan" <the_iddiot(a)hotmail.com> wrote in message
news:4a518b6c-2dd4-4a27-8314-bfb20e3b61d5(a)v29g2000prb.googlegroups.com...
> On furthering on my question from yesterday I just want to know how
> this collection is formed.
>
> Logic demands that form.item(0) would be the first form opened then if
> you open another form form.item(1) would be the ID of that form and if
> you opened another form from the that forms id would be form.item(2)
> then if you closed form.item(2) you would go back to the second opened
> form form.item(1)
>
> So based on this form.item(form.count-1) will always target the last
> form opened. Is this correct or does this collection mess itself up
> and this is not the case.
>
> Regards
> Kelvan


From: Lord Kelvan on
I think you have got the short end of the stick

forms.item(forms.count) wont work because the count of forms is the
form index - 1 as the form index starts off at 0

I am attempting to target the last opened form in the collection of
forms i.e. I have 4 forms opened in my application which from my
understanding is forms.item(forms.count-1) whatever method or property
I use is irrelevant but for sake of argument lets use visible so it I
want to hide the last opened form I would use

Forms.item(forms.count-1).visible = false

My question is not if this is correct because I know this is.

My question is the collection forms.item index order always in the
order of the forms opening order or does it screw with itself and mess
up its index order so the opening order is not the order of the forms
opening.

Regards
Kelvan
From: Arvin Meyer [MVP] on
Did you read the code:

For i = 0 To Forms.Count - 1

That's the same as:

For i = 1 To Forms.Count

Yes, hiding the last form is:

Forms.item(forms.count-1).visible = false

So what you want to do to find out is:

For i = 0 To Forms.Count - 1
Debug.Print Form.Name

and you'll see exactly the order they are addressed.
--
Arvin Meyer, MCP, MVP
Co-author: "Access 2010 Solutions", published by Wiley
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access


"Lord Kelvan" <the_iddiot(a)hotmail.com> wrote in message
news:03b955ff-467b-4682-b89f-b4c8e01d9df8(a)v12g2000prb.googlegroups.com...
>I think you have got the short end of the stick
>
> forms.item(forms.count) wont work because the count of forms is the
> form index - 1 as the form index starts off at 0
>
> I am attempting to target the last opened form in the collection of
> forms i.e. I have 4 forms opened in my application which from my
> understanding is forms.item(forms.count-1) whatever method or property
> I use is irrelevant but for sake of argument lets use visible so it I
> want to hide the last opened form I would use
>
> Forms.item(forms.count-1).visible = false
>
> My question is not if this is correct because I know this is.
>
> My question is the collection forms.item index order always in the
> order of the forms opening order or does it screw with itself and mess
> up its index order so the opening order is not the order of the forms
> opening.
>
> Regards
> Kelvan


From: Lord Kelvan on
Yes I know how to check which order the forms are in again that’s not
my question

I just want to know if the collection is stable as if I opened a form
and I have 3 other forms open will it make the index of that form 3
(i.e. 0,1,2,3) or is there a chance that it will for some unknown
reason make the index of that form 1.

Are there any circumstances this might happen or anything I have to
lookout for when I programme as to no destroy my application because
the last form opened for some reason because of an issue with the
collection that I don’t know about is not the last form in the
collections index.

Regards
Kelvan
 |  Next  |  Last
Pages: 1 2 3
Prev: Don't add record
Next: Text Box