Solved

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

Posted on 2013-05-20
4
489 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
  • 2
4 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
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
Comment Utility
<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
Comment Utility
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
Comment Utility
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now