Print current form record ONLY

WinDancer

Registered User.
Local time
Today, 01:40
Joined
Oct 29, 2004
Messages
290
I have a four-tab form that displays records in continous mode.

When I try to print the curent record it sends them ALL to the printer [=900 pages].

From all my reading today I think there should be a way to print just the 'current record' or apply a filter to limit the print to the currently open record...

Can someone get me started?

Thanks
 
When you print a form, what you're actually doing is a screen grab. If it's a continuous view or a datasheet view form, what you get is all of the records that are currently visible on the screen. And if it's a tabbed form, what you get is what's visible on the current tabbed page. If you want to print out one record, in this situation, you're going to have to create a report and print it with the criteria pointing to the current record. You would have to do the same thing in a Single view form if it had tabbed pages. You can do this easily enough with the Report Wizard.

Linq
 
I already made a report to get this done.

I am doing enhancements to the system now and want to print the form.

Here is the code so far for this form, which is already open:

DoCmd.ApplyFilter , "surveynumber=Forms!frmTabSurvey!surveynumber"
Forms!frmTabSurvey!Page1.SetFocus
DoCmd.PrintOut
Forms!frmTabSurvey!Page2.SetFocus
DoCmd.PrintOut
Forms!frmTabSurvey!Page3.SetFocus
DoCmd.PrintOut
Forms!frmTabSurvey!Page4.SetFocus
DoCmd.PrintOut
DoCmd.Echo True
DoCmd.SetWarnings True

Seems like there is a vba way to limit the records to the survey number in the display with a filter command?

Thanks,
 
I think you can do it better with a Query and a Report. Create a Query based on the underlying Table of the Form, setting the Criteria for Survey Number with Forms!frmTabSurvey!surveynumber. You can use the build... option by right-clicking at the criteria row of the Query under the Survey Number Column (after keeping the Form Open) to set the correct SurveyNumber Field Reference on the Form. Design a Report on the Query. Put a Command Button on your Form and set the HyperlinkSubaddress Property of the Command Button to the Report. It will open in Print Preview when clicked.

Hope it will work.

a.p.r. pillai
http://msaccesstips.com
 
As I said, there is already a Query-driven report in place.

There are about a dozen folks who use this form every day.

Once a week they get together and discuss the current week's findings.

During that meeting they all have copies in front of them to discuss. They are all familiar with the form layout and prefer to work from that.

I am trying to fulfill a request :)

Right now they pick a different person each week to do screen prints, cut and copy them into Word and then make copies for everyone.

I worked most of my life in business areas where IS told you what you could have. Now that I am part of IS I try very hard not to do that to my customers.

I appreciate very much the time folks took to try to help.

Thank You!
 
It is kind of confusing to tell what the problem is, Are you trying to print a form or a report? Is your code to filter your form not working? If you are trying to filter your form and it is not working, have you tried
DoCmd.ApplyFilter , "[surveynumber]=" & Forms!frmTabSurvey!surveynumber
instead?
 
Just went and corrected the syntax to match your suggestion.
It printed all four tabs for the current record AND then it stopped, instead of printing all 900 pages.
Thank you, Alisa!!
 
its always the little things that mess me up too
 
There is something just wrong about microsoft software.
You can fight with something for days, get a zillion different error messages, and when you get it right finaly there is no fanfare, no good job, nothing. It just does the instructions- quite a letdown when it finally runs. I learn at least a couple of new things wirth every db I build, even after 15 years of it. Thank you SOOOO much for your help, :)
 
i hope my problem is as easy to correct as his was.

I have almost this same problem. I have a main form with tabs. On each tab is a subform. The reason I didn't do a report, is that my fields are based on user chosen radio buttons. These assign values of 1 for yes 2 for no and 3 for na. I then use VB code to calculate the scores. I created a separate form named Form Report that uses similar code to display Yes for 1 etc. I want to print from only this one tab. The form itself has a print button with this code(automatically generated by command button wizard):

Code:
Private Sub printRecord_Click()
On Error GoTo Err_printRecord_Click

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.PrintOut acSelection

Exit_printRecord_Click:
    Exit Sub

Err_printRecord_Click:
    MsgBox Err.Description
    Resume Exit_printRecord_Click
    
End Sub

it works great when i open up just the one form, Form Report. However, when i have it open in the Main form under it's tab, i click the button and it tries to print every record.
 
Here is the code that prints just the first record. It works correctly.
May help you...
 
thanks

I decided to pop open the single form and just print that. then i close the form again. Thanks for trying to help, but i can't see any code. just your text.
 

Users who are viewing this thread

Back
Top Bottom