Solved

Printing single record supreports in Access 2010

Posted on 2012-12-29
4
280 Views
Last Modified: 2013-01-02
Good day,

I'm having some trouble getting my report in access to print how I want it to. I have a couple of tables I'm trying to work with, one has a list of names and the other has some information about their care. I created two reports called Patients and then Progress_Note, and I want to be able to print out a single report with information from the Patient table and the Progress_Note table.

I tried making a button on the Progress_Note form that looks like
DoCmd.OpenReport "Patients", acViewPreview, , "ID=" & Me.ID

Open in new window


Right now, if I have up record 6 is on the Progress Note, it doesn't print record 6 from the Progress Note table but record 6 from the Patient table. I thought it might be a relationship problem with my database, but my tinkering with that has proven unsuccessful.

I just want to be able to pull up the Progress Note and have it print a single note and pull in the data from the patient table (like the patient name and D.O.B. with the notes from that single progress note.

I've attached the database with some rough data in it for troubleshooting purposes.

Thanks a ton.
29-Dec---V2.accdb
0
Comment
Question by:darantares
  • 2
4 Comments
 
LVL 39

Expert Comment

by:als315
Comment Utility
Progress_Note table has duplicate fields: Prog_Note_ID and Patient. Why?
You have different ID fields on form and on report. You should add Prog_Note_ID to form and change command to:
DoCmd.OpenReport "Patients", acViewPreview, , "ID=" & Me.Prog_Note_ID
29-Dec---V2.accdb
0
 
LVL 39

Accepted Solution

by:
als315 earned 500 total points
Comment Utility
If you like to have only one record in subreport, test this sample (Report1 button)
29-Dec---V2.accdb
0
 
LVL 30

Expert Comment

by:hnasr
Comment Utility
You may build the report on the query: paqtient_q

SELECT Patients.[First Name], Patients.[Last Name], Patients.Diag_Code, Patients.D_O_B, Patients.Referring_Dr, Progress_Note.Eval_date, Progress_Note.Prog_Note_ID, Progress_Note.Status
FROM Patients INNER JOIN Progress_Note ON Patients.ID = Progress_Note.Prog_Note_ID;

Chek report patient_q

You may filter for required ID when you open the report from the relevant form.
Q-27980794-29-Dec---V2.accdb
0
 

Author Closing Comment

by:darantares
Comment Utility
Perfect! Does exactly what I want it to, and I was able to modify it to work on another report. Thanks a ton!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

762 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

6 Experts available now in Live!

Get 1:1 Help Now