[AccessD] report control not displaying right value

Susan Harkins ssharkins at gmail.com
Wed Nov 7 06:41:10 CST 2007


I've put it everywhere, but I'll try again, just in case! ;)

Susan H.


> Hi Susan
>
> Have you tried moving this line to the OnPrint event:
>
>  Me.txtHeaderLast = col(Me.Page)
>
> /gustav
>
>>>> ssharkins at gmail.com 07-11-2007 02:29 >>>
> The following code is a simple solution, I thought, to displaying the last
> item on a page in the page header section. I've dropped in a few Debug
> statements to verify that the collection is storing and retrieving the 
> right
> items, but the control always displays the first item on the page. I'm
> clueless -- I have no idea what's happening here.
>
> Basically, during the first pass (I'm using the report Pages property to
> force a second formatting run), I'm storing the last item on each page --
> the value of txtFooterLast -- in a Collection object. That part works 
> fine.
> Then, the report retrieves those values using the page number as the index
> value. The Debug statements verify that the right values are in the
> collection, however, txtHeaderLast doesn't display the results of
> col(Me.Page) -- it displays the first value on the page, not the value
> retrieved from the Collection. I just don't have any explanation.
>
> Option Compare Database
> Option Explicit
> Dim col As New Collection
>
>
> Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As
> Integer)
>  Debug.Print Me.Page
>  Debug.Print col(Me.Page)
>  Me.txtHeaderLast = col(Me.Page)
>  Debug.Print Me.txtHeaderLast.Value
> End Sub
>
> Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
> Integer)
>  Me.txtFooterFirst = Me.txtHeaderFirst
>  Me.txtHeaderLast = Me.txtFooterLast
>  If Me.Pages = 0 Then
>    col.Add Me.txtFooterLast, CStr(Me.Page)
>  End If
> End Sub
>
> Private Sub Report_Close()
>  Set col = Nothing
> End Sub
>
>
>
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com 




More information about the AccessD mailing list