|
 |
access thread: Form Print
Message #1 by "KennethMungwira" <KennethMungwira@Y...> on Fri, 15 Feb 2002 18:35:30
|
|
Dear Sir or Madam,
Does anyone know how to have print button that only prints the current
record, not the whole record set. I would like my users to print, or
attach the information infront of him to an email.
thank you
Kenneth
The following is the code from the tool box, Print Current Form-does not
work?
Private Sub Command93_Click()
On Error GoTo Err_Command93_Click
DoCmd.PrintOut
Exit_Command93_Click:
Exit Sub
Err_Command93_Click:
MsgBox Err.Description
Resume Exit_Command93_Click
End Sub
Message #2 by PStreeter@C... on Fri, 15 Feb 2002 13:21:13 CST
|
|
On Fri, 15 Feb 2002 18:35:30 "KennethMungwira" wrote:
> Does anyone know how to have print button that only prints the current
> record, not the whole record set. I would like my users to print, or
> attach the information infront of him to an email.
>
> thank you
>
> Kenneth
> The following is the code from the tool box, Print Current Form-does not
> work?
>
> Private Sub Command93_Click()
> On Error GoTo Err_Command93_Click
>
>
> DoCmd.PrintOut
>
> Exit_Command93_Click:
> Exit Sub
>
> Err_Command93_Click:
> MsgBox Err.Description
> Resume Exit_Command93_Click
>
> End Sub
> ---
It prints the entire table. What I have done is create a report
of the same fields, etc, put a command button on the form to
print the report, then modify the button's event proc by adding
the filter setting code that can be found in Access Help if you
are on a lucky day. I'll copy it below from an app of mine.
Private Sub Screen_Print_Click() 'from Wizard
On Error GoTo Err_Screen_Print_Click 'from Wizard
Dim stDocName, ReptFilter As String 'from Wizard
stDocName = "Employer/Client_Screen_Print" 'from Wizard
ReptFilter = "[Employer/Client]![FEIN]
[Forms]![Employer/Client_F000100]![FEIN] " _
& "and [Employer/Client]![Zip_Code]
[Forms]![Employer/Client_F000100]![Zip_Code]"
DoCmd.RunCommand acCmdSaveRecord ' This saves the record to make
'sure that the printout agrees with the form.
DoCmd.OpenReport stDocName, acNormal, , ReptFilter 'from Wizard
Exit_Screen_Print_Click: 'from Wizard
Exit Sub 'from Wizard
Use your own table, form, and field names of course. Saving the
record was my addition because of an end user who could not
understand using shift-enter to get her changes written to the
table before trying to print the page.
Paul
|
|
 |