Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last record on a report page

Status
Not open for further replies.

Aubs010

Technical User
Apr 4, 2003
306
GB
How can you find out if a record is the last record on a report page?

I've tried using things like:
Code:
If Reports("rptElements-NonCompliant").Section("Detail").WillContinue = False
If Reports("rptElements-NonCompliant").MoveLayout = True
If Reports("rptElements-NonCompliant").PrintSection = True



But...[ol][li]The record does not continue over to the next page[/li]
[li]The MoveLayout property specifies whether Microsoft Access should move to the next printing location on the page. Read/write Boolean. [tt]-This references for EVERY record, and every one is TRUE![/tt][/li]
[li]The PrintSection property specifies whether a section should be printed. Read/write Boolean. [tt]- They all should be printed, so all records are TRUE[/tt][/li]
[/ol]

I hope someone will be able to help me with this.

Thanks for your time,


Aubs
 
Ok, something else that I have tried, that may give someone a bit of inspiration!!

in the report footer, I have created a hidden text box called 'LastRecord' that references the [ref] field. This is then compared in code as:

If [Ref] == [LastRecord] Then

BUT, I think the problem I have is that when access loads each record into the report, the current record is classed as the last record on the page (until the next record is added) so this doesn't work!

Any suggestions would be appreciated!


Aubs
 
Can you tell me why you are trying to detect the "last record"??
This could influence how we go about getting this info and what we do with it!
 
Okay,

I need to find out which is the last record on a report page so I can draw a horisontal line under the report.

The line can not go in the footer because on some pages the last record is too far from the footer.

The code I have to draw a line is:
Code:
        Dim LastRecordBottomLineTop As Single, LastRecordBottomLineLeft As Single
        Dim LastRecordBottomLineWidth As Single, LastRecordBottomLineHeight As Single
        LastRecordBottomLineTop = 0
        LastRecordBottomLineLeft = 1270
        LastRecordBottomLineWidth = 11010
        LastRecordBottomLineHeight = 1280
        LastRecordBottomLineColor = RGB(255, 0, 0)
        Me.DrawWidth = 5
        Me.Line (LastRecordBottomLineTop, LastRecordBottomLineLeft)-(LastRecordBottomLineWidth, LastRecordBottomLineHeight), LastRecordBottomLineColor, B
        Me.DrawWidth = 0

so I would like something, say an IF statement, that would be able to pick out if a recod is the last record on the current page and do the line as above...

Thanks in anticipation,


Aubs
 
I get the impression that you are using Group header(s) as you say "on some pages the last record........" if this is the case, if you introduce a Group footer and actually draw a line in there, then this will appear at the end of each group and will be before the start of the next group.
 
Trendsetter is right and this is the way I'd do it (no code is required).

But just out of curiosity (or if you already have 10 groups - highly unlikely), you could try this:

Create a line below the data in the detail section. Call it LineName.
Create an invisible textbox in detail section (RecCounter).
ControlSource: =
RunningSum = Over All

Create a textbox (TotalCount) in the report footer or header:
Control Source: =Count(*)

In the detail section format procedure:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
LineName.Visible = RecCounter = TotalCount
End Sub

Good luck



[pipe]
Daniel Vlas
Systems Consultant

 
No, I'm not using groups.

the reason is because say for example the first page, I have a large report header that sets the last record on that page to about 10mm from the report footer, whereas on all the other pages, there is no report header and funnnily enough the footer is about 5mm from the footer. then again, the last page might only have 2 records on it so having a line in the footer would be miles away... as this example:


The lines I have coloured RED are the ones I want inserted at the last record of the page

Page1 (First Page):
Code:
 _______________________
|     Report Header     |
|       Goes Here       |
|-----------------------|
|     Page Header       |
|-----------------------|
| Record1               |
|                       |
| Record2               |
|                       |
| Record3               |
|                       |
| Record4               |
|                       |
| Record5               |
|                       |
| Record6               |
|
[tt]-----------------------[/tt]
Code:
|
|                       |
|                       |
|     Page Footer       |
|_______________________|

Page2 (Middle Pages):
Code:
 _______________________
|-----------------------|
|     Page Header       |
|-----------------------|
| Record7               |
|                       |
| Record8               |
|                       |
| Record9               |
|                       |
| Record10              |
|                       |
| Record11              |
|                       |
| Record12              |
|                       |
| Record13              |
|                       |
| Record14              |
|
[tt]-----------------------[/tt]
Code:
|
|     Page Footer       |
|_______________________|

Page3 (Last Page):
Code:
 _______________________
|-----------------------|
|     Page Header       |
|-----------------------|
| Record15              |
|                       |
| Record16              |
|
[tt]-----------------------[/tt]
Code:
|
|                       |
|                       |
|                       |
|                       |
|                       |
|                       |
|                       |
|                       |
|                       |
|                       |
|                       |
|                       |
|     Page Footer       |
|_______________________|

I hope this makes it more understandable...








Aubs
 
Any ideas?

I'm still trying to find out how I can reference the *last* record that is on each page...

Thanks to anyone who looks and tries!

Aubs
 
Could you send me your app so that I can attempt to solve your current situation.
franl@fhsservices.co.uk
 
Does anyone have any suggestions on how I cna do it?

Thanks for your time via email Trendsetter.

If there's anything I can do for anyone that will help, just ask!

I'm getting desparate to ge tthis finished!

Many thanks,

Aubs

Aubs
 
ok, I finally got it working!

Thanks anyways :)

Aubs
 
I'm pleased for you - I have spent some time but have not had any joy as I think I was trying to do something that I didn't understand properly.
I would interested in knowing how you achieved the format you were after.

Frank J Hill
FHS Services Ltd.
frank@fhsservices.co.uk
 
Yes, please share the wealth....I came up with something that was close, but not quite there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top