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
Solved

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

Posted on 2013-05-20
4
517 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 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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 …

860 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