View Single Post
  #5  
Old March 28th, 2010, 10:45 PM posted to microsoft.public.access.gettingstarted
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Create a button that prints the selected record of a report

On Sat, 27 Mar 2010 22:20:02 -0700, forest8
wrote:

My main form has information on a student, i.e. name, age, program of study.
The subform is a tabcontrol that deals with detailed information on the
student.

If there are 100 students, how do I only print out the information for
student 79?

I hope this isn't too silly to ask but I don't really understand how this
works. I understand forms but not reports.


I think you need to clarify your understanding of forms too.

You say that your main form has information. IT DOESN'T.

Your *tables* have information. That's the only place in your database that
the information is stored!

A Form is a tool to display information from a table on the screen in a way
that lets you view, edit, and add more information... to the tables.

A Report is a tool to display information from a table in a way that lets you
print it (or print preview it).

Either a form or report can be based directly on a Table, or (much more
usefully!) on a Query which selects desired fields and records from the table.

If you want to see information about student 79 printed, you can base your
Report on a Query selecting information only about that student. A common way
to do this is to use a Parameter Query, with a criterion referencing a form.
E.g. if you have frmStudents, with a control named StudentID, you could base
your report on a query with a criterion

=Forms!frmStudents!StudentID

on the ID field. This will pull data for the student whose ID is currently on
the form, from the table or tables, and lay it out on the report.
--

John W. Vinson [MVP]