Code for Me.Line.Visible?

T

Telesphore

I have this part of code in a report:

If GrpArrayPage(Me.Page) = 1 And GrpArrayPages(Me.Page) > 1 Then
Me.Line.Visible = False
Else
Me.Line.Visible = True
End If

It works well with 1 or 2 pages, but not with 3.

Any suggestions. Thanks
 
T

Telesphore

BTW theis part of code was

If GrpArrayPage(Me.Page) = 1 And GrpArrayPages(Me.Page) > 1 Then
Me.LineDirector.Visible = False
Me.LineText.Visible = False
Else
Me.LineDirector.Visible = True
Me.LineText.Visible = True
End If

Usually the report is of 2 pages, but it happens occasionally that it has
3 pages and in this case the visibility of the LineDirector and LineText
appear on page 2
and 3. We want it only on the last page of the report.


What we need
 
T

Telesphore

Yes.

You will notice that this is a very well known code for page numbering:


Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer

Private Sub Footer_Format(Cancel As Integer, FormatCount As Integer)

On Error GoTo ContrôleErr

Dim i As Integer
If Me.Pages = 0 Then
ReDim Preserve GrpArrayPage(Me.Page + 1)
ReDim Preserve GrpArrayPages(Me.Page + 1)

GrpNameCurrent = Me!FullName
If GrpNameCurrent = GrpNamePrevious Then
GrpArrayPage(Me.Page) = GrpArrayPage(Me.Page - 1) + 1
GrpPages = GrpArrayPage(Me.Page)
For i = Me.Page - ((GrpPages) - 1) To Me.Page
GrpArrayPages(i) = GrpPages
Next i
Else
GrpPage = 1
GrpArrayPage(Me.Page) = GrpPage
GrpArrayPages(Me.Page) = GrpPage
End If
Else
Me!ctlGrpPages = "Page " & GrpArrayPage(Me.Page) & " de " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent

If GrpArrayPage(Me.Page) = 1 And GrpArrayPages(Me.Page) > 1 Then
Me.LineDirector.Visible = False
Me.LineText.Visible = False
Else
Me.LineDirector.Visible = True
Me.LineText.Visible = True
End If

....
 
T

Telesphore

Solution found in Google:

If [Page] = [Pages] Then
Me.LineDirector.Visible = True
Me.LineText.Visible = True
Else
Me.LineDirector.Visible = False
Me.LineText.Visible = False
End If

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top