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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigate a Report

Status
Not open for further replies.

MajP

Technical User
Aug 27, 2005
9,382
US
Is there a way to navigate around an open report programmatically? With a form I can do a MoveFirst or findrecord or set the bookmark. I can not figure out how to do this with a report. I would like to build a form that a user could identify a record and move the report to that location.
 
MajP
Since a report is, in fact, something that shows all records selected...and is therefore a snapshot, if you will, of what has been selected to show...why would you want to do what you asked, even if you could?

If you want to view a particular record, why not set things up to show only that specific record in the report?

Tom
 
To say that the report is a snapshot is definately misleading. Actually I would think it is quite the opposite. Since the report pulls the data but does not really exist until the page events, format events, and retreat events take place. If that were true you could not modify the output through the Page event, format event, or Print event. A report is definately dynamic. You can retrieve the current record in the Page event or another event
Private sub report_page()
intAbsPosition = me.currentrecord
end sub
but there is no way to go to that position. So my thought was that you could find the absolute position of a record in a reports recordset. Programmatically move the pages like you would by clicking the navigation button. Stop when the current record is >= to the intAbsPosition.
Anyways here is why. I have a very large report with several chapters. The user may want to go to a specific record in the report, but will usually need to review some information before or after. The user probably does not know what additional records he needs to look at. Think of researching something in a textbook.

 
MajP
Well, I agree with you that using the word "snapshot" is misleading. Because Access applies a special definition to that word. Poor choice of words - I had no intention to mislead. You are right that a report is dynamic.

I see what you are wanting to do, and that would be nice to do.

I'm not aware that you can navigate to that record after the report is opened...but if you are able to identify, through your process, a particular record that will be contained in the report, could you put code, probably in the report's Format event, that highlights that record by shading it or something like that?

To test that, I just put the following code on the Format event for the Detail section of a report...
If Me.FullName = "Babcock, Dale" Then
Me.FullName.ForeColor = vbRed
Else: Me.FullName.ForeColor = vbBlack
End If

That worked. I don't know whether or not this helps your situation.

All the best with your project.

Tom
 
Or, output your report to a PDF format that allows users to search the text.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top