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

Current form only print 1

Status
Not open for further replies.

joeyw

Technical User
Oct 14, 2005
2
US
I am a VERY new user to Access and have a purchase orderform with subform that I want to print. When I add a print form button, i get the entire data base print.

How do I select a single form?
 
On the side of the main form you should see a record selector. Select the record you want and go file > print then select the option for selected records.

For future refrence, I don't print Fomrs, I only print reports. You may consider creating a report for the one you want, then printing from there.

Hope this gets you closer to the solution.

Andrew
a.k.a. Dark Helmet

"What's the matter Colonel Sandurz? Chicken?
 
To print one Purchase order you would add a selection criteria (where condition) to the OpenReport statement. For example, say PONO is a unique value in your table. The On Click event of the Print command would have this code. The portion of stLinkCriteria that is in quotes is the field in your table. Of course if it's a text field you would have to adjust the quotes.

Dim stFormName as string
Dim stLinkCriteria as string

stFormName = "rptPrintOne"
stLinkCriteria = "[PONO]=" & Me![PONO]

DoCmd.OpenReport stFormName, acViewPreview, , stLinkCriteria
 
tbclbd

I have tried this your code, but still prints all report pages when selected the current "[PONO]". On other selections, just for a blank report, no data.
 
When you put the subform on the form, did you link the two by a unique field? If you don't link them, the subform will show all records.

Also if your PONO field is text you would have to change the syntax of stLinkcriteria

stLinkCriteria = "[PONO] = '" & Me![PONO] & "'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top