Solved

MS Access - Click Value on Report to Bring up Underlying Data

Posted on 2013-05-20
4
535 Views
Last Modified: 2013-05-20
I have an access report that lists fields like ID, Date and Summary. I have used the following code to make the ID clickable to bring up a report on the selected record, but it is bringing up a blank report. Thoughts on how to make this work?

Private Sub ePMRef_Click()
DoCmd.OpenReport "Project Summary", acViewReport, , "[ePMRef]= '" & [ePMRef] & "'"

End Sub
0
Comment
Question by:bezellvi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 39182357
try changing

DoCmd.OpenReport "Project Summary", acViewReport, , "[ePMRef]= '" & [ePMRef] & "'"

with

DoCmd.OpenReport "Project Summary", acViewPreview, , "[ePMRef]= '" & Me.[ePMRef] & "'"


if [ePMRef] is number type of data, use this


DoCmd.OpenReport "Project Summary", acViewPreview, , "[ePMRef]= " & Me.[ePMRef]
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39182469
<No Points wanted, as capricorn1 has already your question.>

Your clickable ID technique will only work if the report is in "Report View"
Report View will allow for interaction,  (and Filtering, ..etc)
...But it does have some potential drawbacks.
1. It may not render graphics (per record) correctly
2. Will not display accurate "Page x of y" numberings
3. It will not run any potential custom code on any Format events

In other words it will not give you a true "Print Preview"

To deal with this you can use a buttons on a form to decide what "view to open the report in:

DoCmd.OpenReport "YourReport", acViewReport
Or
DoCmd.OpenReport "YourReport", acViewPreview


Again, no points wanted, just some extra info..

;-)

JeffCoachman
0
 

Author Comment

by:bezellvi
ID: 39182477
Thanks - I got it. One other issue I'm having - a report footer is saying 1 of 10 pages when I go to print, but there are only 8 pages...
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39182510
This may be another, unrelated issue.

Since capricorn1 has answered you original question correctly, you should accept his post and create a new question for this new issue.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question