Re: Printing Multiple Copies of a Report Form.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Fred,

I resolve the error message by adding "True" to the SelectObject method.

But I am having two problems.

1 -I am unable to cancel the InputBox prompt. It still print even though i
cancel.
2 - The Database box is popping up every time I running this code.

Thanks
Ileana



"iholder" wrote:

> Thanks Fred,
>
> This is great, but I am getting an error message
>
> "The Object "rptOperatorDailyCallSheet-2" isn't open.
>
> "fredg" wrote:
>
> > On Tue, 18 Oct 2005 07:09:02 -0700, iholder wrote:
> >
> > > Fred, below is a sample of the code you assisted me the PrintOut Method.Dim
> > > stDocName As String
> > > DoCmd.RunCommand acCmdSaveRecord
> > > Dim Message, Title, Default, PrintCopies
> > > Message = "Enter Number of Copies" ' Set prompt.
> > > Title = "Print Operator Daily Call Sheet" ' Set title.
> > > PrintCopies = InputBox(Message, Title) ', Default)
> > > stDocName = "rptOperatorDailyCallSheet-2"
> > > DoCmd.OpenReport stDocName, acPrint
> > > DoCmd.PrintOut , , , , PrintCopies, ' 0 ' 0=not collated
> > >
> > > The PrintOut method is printing the report and form on the screen.
> > > It is print one copy of the report and additional copies of the screen form.
> > > For example. Copy input is (3) 1 copy of the report and 2 copies of the
> > > screen form.
> > >
> > > What adjustments need to be made.
> > >
> > > "fredg" wrote:
> > >
> > >> On Fri, 14 Oct 2005 08:52:02 -0700, iholder wrote:
> > >>
> > >>> What is the syntax to send mulitple copies of a report to the printer.
> > >>> Example or sample ?
> > >>> I am using a HP Laser 4200 printer.
> > >>>
> > >>> Thank You.
> > >>
> > >> Look up the PintOut method in VBA help.
> > >> --
> > >> Fred
> > >> Please respond only to this newsgroup.
> > >> I do not reply to personal e-mail
> > >>
> >
> > If you Dim variables, you should also set their types, otherwise they
> > are all going to be Variant.
> > You had incorrect parenthesis within the InputBox function.
> > You had the Collate argument within single quotes which would make it
> > a string. It must be a number.
> > If you just wish to print the report, there is no need to open it in
> > preview.
> >
> > Dim stDocName As String
> >
> > Dim strMessage as String, strTitle as String
> > Dim intDefault as Integer, intPrintCopies as Integer
> >
> > intDefault = 1 ' You do want at least one copy printed, don't you?
> > strMessage = "Enter Number of Copies" ' Set prompt.
> > strTitle = "Print Operator Daily Call Sheet" ' Set title.
> > intPrintCopies = InputBox(Message, Title, Default)
> > stDocName = "rptOperatorDailyCallSheet-2"
> >
> > DoCmd.RunCommand acCmdSaveRecord
> >
> > DoCmd.SelectObject acReport, stDocName, True
> > DoCmd.PrintOut acPrintAll, , , , intPrintCopies, 0
> >
> >
> > The whole procedure can be shortened to the following:
> >
> > DoCmd.RunCommand acCmdSaveRecord
> > DoCmd.SelectObject acReport, "rptOperatorDailyCallSheet-2"
> > DoCmd.PrintOut acPrintAll, , , , InputBox("Enter Number of Copies", _
> > "Print Operator Daily Call Sheet",1), 0
> >
> > Look up the SelectObject in VBA help.
> >
> >
> > --
> > Fred
> > Please respond only to this newsgroup.
> > I do not reply to personal e-mail
> >
.



Relevant Pages

  • RE: list form
    ... Dim stDocName As String ... Dim stLinkCriteria As String ... through those controls, building an SQL string that is written to a hidden ...
    (microsoft.public.access.forms)
  • RE: Invalud Use of Null
    ... Dim stDocName As String ... Dim stLinkCriteria As String ... Dim MyContactOpenArgs As String ...
    (microsoft.public.access.formscoding)
  • RE: list form
    ... Continuous Form Lists multiple records but customizable ... Dim stDocName As String ... Dim stLinkCriteria As String ...
    (microsoft.public.access.forms)
  • Re: Passing Openform arguments from tables
    ... Dim stDocName As String ... Dim stDocOpenMode As String ...
    (comp.databases.ms-access)
  • RE: SetFocus strange problem
    ... Private Sub Form_Current ... Dim stLinkCriteria As String ... DoCmd.OpenForm stDocName,,, stLinkCriteria ...
    (microsoft.public.access.formscoding)