[AccessD] storing last item on the page

Susan Harkins ssharkins at gmail.com
Sat Nov 10 08:33:49 CST 2007




>    In your code, second statement in page footer's format event is also 
> redundant. The real assignment for txtHeaderLast is taking place in page 
> header's print event. First two lines of existing code block can be 
> removed. The only portion required in page footer's format event is the 
> block of three lines meant to build up the collection.

======Oh, you're right. I think that's just a residual from my original 
attempt and I did a bad job of cleaning up. Thanks for pointing that out.
>
>    In page header's print event, while retrieving information from 
> collection object, you have used number argument, which returns values as 
> per index position in collection. This method does not take advantage of 
> key strings that you have embedded (via CStr(Me.Page) as the second 
> argument) while adding to the collection. Though in the present case, your 
> results are not affected (being a simple situation), it is considered 
> preferable in the interest of greater reliability to retrieve values using 
> key (where available) instead of number index (specially if the collection 
> is likely to get disturbed for some reason). Second statement in page 
> header's print event would then become:
>
>    Me.txtHeaderLast = col(CStr(Me.Page))
>
>    On the other hand, if you wish to continue using number index, it is 
> not necessary to provide the second argument (for key string) in 
> collection's Add method. The existing statement in page footer's format 
> event would then become:
>
>    col.Add Me.txtFooterLast.Value

=======I don't understand what you're saying. I'm really sorry -- let me ask 
a few questions, so you don't have to repeat yourself. I do see the 
inconsistency now that you point it out -- I use CStr(Me.Page) to store that 
value as a string, as required by the Collection object, but then I used 
Me.Page to retrieve members -- so I think what you're saying is that the 
code isn't even using the Me.Page value to retrieve values? That's where I 
get lost. If not the Me.Page value, then what? Thanks for your help.

Susan H. 




More information about the AccessD mailing list