Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Current Form as Report ONLY

Status
Not open for further replies.

JRA

Programmer
Apr 19, 2001
106
0
0
CA
Hello ...

I've created my form that's linked to my table and I have a 'print as report' button on my form. What's happening though is when I print my report, more than one report is being printed at a time. What I want to do though is to just print the current report. How do I set it up so that this happens? When the data is stored in my table it would just be the current one line or row being printed because all data for the one report is stored in one row (line) in my table.

Thanks in advance for your help,
James.
 
I still need help if anyone knows how to do this ...
 
I'm not sure what you mean by 'print as report'. If you mean that you made a report using the same query as the form, and you want the report to show just the current record of your form, then use this in the on_click event of your button:
Code:
docmd.OpenReport "",,,"field -" & field
substitute 'field' by the name of an unique field in your query.
 
Sorry, should be "field = " & field
but you guessed as much already I guess...
 
Ok ... lets say my table is set up with column headings: 'PC Number1', 'Client First Name1', 'Client Last Name11' ... 'PC Number12', 'Client First name12', 'Client Last Name12'. Each time this form is opened and data is entered, it then prints a report when a command button is clicked. What is happening though, is the first row with the above heading columns is being printed and then the second row with the above heading columns is being printed. What I want to happen though is that only the current form in use print a report with the current data and not a series of reports with the data from past entries. How do I set it up so that only the current report is being printed out?
 
I guess the data-source of your report is the same table?
You have to apply a filter, to select the record that matches the current record on your form. To do that, you need an unique field in your table (usually called ID) or an unique combination of fields.
If the print-button on your forms refers to VBA-code and the ID is numeric use:
Code:
 DoCmd.OpenReport "MyReport", acViewPreview, , "ID =" & ID
If you use a macro fill in the WHERE clause:
[ID]=[Forms]![MyForm]![ID]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top