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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing only one record in a form...

Status
Not open for further replies.

stlrain95

Programmer
Sep 21, 2001
224
US
I have a form that shows data from 2 different tables joined by one field (RIN).

I need to add a print button to the form so that the user can print only that record with it's action items. I added a button to print using the wizard and it prints out all the records instead of the one that is shown.

What can I do to fix this??

thanks in advance.
 
Yes you have to create a report first
then in the reports "Record Source" Property click the 3 dots and make a Query.
In the query put the fields and tables you deisre on your report.

Now in the key field, I think its your "RIN"
Put the forms name and the field in the Criteria box like so

-----------------------------------------
Field RIN
Table
Sort
Show X
Crieteria =Forms![formname].form!RIN
------------------------------------------
This will print the report based on which record is currently on the form. DougP, MCP
 
I may have to do that. But what I have done instead, and would like to do is this.

I have created a print button on the form, in the VB code for the button (ON CLICK) I have put the following code.

Dim strDocName As String
Dim strWhere As String
strDocName = "Reliability Investigation Report"
strWhere = "[RIN]=" & Me!RIN
DoCmd.OpenReport strDocName, acPreview, , strWhere

This code opens the report before I print, but doesn't show the RIN? I guess I need to add something in the report or build a query?

Any suggestions?
 
I did it your way, and it works better and easier.

But I have one problem!!

In the criteria part of the SQL, I put your line. But it changes it to this.

[Forms]![RI_OPEN(MAIN)].[form]![RIN]

And that reads on the window. I need that to only say "What is the RIN?"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top