Printing form with current record

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    Printing form with current record

    Hi

    If I have a form open, what is the code that is equivalent to using the
    File->Print menu with select record(s) option to print the form with the
    currently displayed record values?

    Thanks

    Regards


  • Allen Browne

    #2
    Re: Printing form with current record

    In general, it's best to create a report for printing. You can then
    precisely control how the print should be laid out. If it helps, you can
    save the form as a report (File | Save As, in design view) to give you a
    running start.

    You can then use the primary key value in the form to identify the record to
    be printed. Example code in:
    Print the record in the form
    at:
    How to add a button to a form in a Microsoft Access database, so as to print just the active record in the form.


    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "John" <John@nospam.in fovis.co.uk> wrote in message
    news:%23wHLCfr6 FHA.2616@TK2MSF TNGP15.phx.gbl. ..[color=blue]
    >
    > If I have a form open, what is the code that is equivalent to using the
    > File->Print menu with select record(s) option to print the form with the
    > currently displayed record values?[/color]


    Comment

    • John

      #3
      Re: Printing form with current record

      Hi Allen

      Thanks for that but the client want a simple dump of the form with the
      currently displayed record. I figured If I could automate the File-Print
      command with Selected Record(s) option that'll do the trick.

      Thanks

      Regards

      "Allen Browne" <AllenBrowne@Se eSig.Invalid> wrote in message
      news:437b434b$0 $9956$5a62ac22@ per-qv1-newsreader-01.iinet.net.au ...[color=blue]
      > In general, it's best to create a report for printing. You can then
      > precisely control how the print should be laid out. If it helps, you can
      > save the form as a report (File | Save As, in design view) to give you a
      > running start.
      >
      > You can then use the primary key value in the form to identify the record
      > to be printed. Example code in:
      > Print the record in the form
      > at:
      > http://allenbrowne.com/casu-15.html
      >
      > --
      > Allen Browne - Microsoft MVP. Perth, Western Australia.
      > Tips for Access users - http://allenbrowne.com/tips.html
      > Reply to group, rather than allenbrowne at mvps dot org.
      >
      > "John" <John@nospam.in fovis.co.uk> wrote in message
      > news:%23wHLCfr6 FHA.2616@TK2MSF TNGP15.phx.gbl. ..[color=green]
      >>
      >> If I have a form open, what is the code that is equivalent to using the
      >> File->Print menu with select record(s) option to print the form with the
      >> currently displayed record values?[/color]
      >
      >[/color]


      Comment

      • Allen Browne

        #4
        Re: Printing form with current record

        Try:
        RunCommand acCmdSelectReco rd
        DoCmd.PrintOut acSelection

        I hate to even tell you how to do something that badly, though. :-)

        --
        Allen Browne - Microsoft MVP. Perth, Western Australia.
        Tips for Access users - http://allenbrowne.com/tips.html
        Reply to group, rather than allenbrowne at mvps dot org.

        "John" <John@nospam.in fovis.co.uk> wrote in message
        news:jPGdnZuND9 3U0-benZ2dnUVZ8tydn Z2d@pipex.net.. .[color=blue]
        >
        > Thanks for that but the client want a simple dump of the form with the
        > currently displayed record. I figured If I could automate the File-Print
        > command with Selected Record(s) option that'll do the trick.
        >
        > "Allen Browne" <AllenBrowne@Se eSig.Invalid> wrote in message
        > news:437b434b$0 $9956$5a62ac22@ per-qv1-newsreader-01.iinet.net.au ...[color=green]
        >> In general, it's best to create a report for printing. You can then
        >> precisely control how the print should be laid out. If it helps, you can
        >> save the form as a report (File | Save As, in design view) to give you a
        >> running start.
        >>
        >> You can then use the primary key value in the form to identify the record
        >> to be printed. Example code in:
        >> Print the record in the form
        >> at:
        >> http://allenbrowne.com/casu-15.html
        >>
        >> "John" <John@nospam.in fovis.co.uk> wrote in message
        >> news:%23wHLCfr6 FHA.2616@TK2MSF TNGP15.phx.gbl. ..[color=darkred]
        >>>
        >>> If I have a form open, what is the code that is equivalent to using the
        >>> File->Print menu with select record(s) option to print the form with the
        >>> currently displayed record values?[/color][/color][/color]


        Comment

        • John

          #5
          Re: Printing form with current record

          Thanks for this. Any way to select the printer and/or page orientation
          before printing?

          "Allen Browne" <AllenBrowne@Se eSig.Invalid> wrote in message
          news:437b4ff0$0 $9989$5a62ac22@ per-qv1-newsreader-01.iinet.net.au ...[color=blue]
          > Try:
          > RunCommand acCmdSelectReco rd
          > DoCmd.PrintOut acSelection
          >
          > I hate to even tell you how to do something that badly, though. :-)
          >
          > --
          > Allen Browne - Microsoft MVP. Perth, Western Australia.
          > Tips for Access users - http://allenbrowne.com/tips.html
          > Reply to group, rather than allenbrowne at mvps dot org.
          >
          > "John" <John@nospam.in fovis.co.uk> wrote in message
          > news:jPGdnZuND9 3U0-benZ2dnUVZ8tydn Z2d@pipex.net.. .[color=green]
          >>
          >> Thanks for that but the client want a simple dump of the form with the
          >> currently displayed record. I figured If I could automate the File-Print
          >> command with Selected Record(s) option that'll do the trick.
          >>
          >> "Allen Browne" <AllenBrowne@Se eSig.Invalid> wrote in message
          >> news:437b434b$0 $9956$5a62ac22@ per-qv1-newsreader-01.iinet.net.au ...[color=darkred]
          >>> In general, it's best to create a report for printing. You can then
          >>> precisely control how the print should be laid out. If it helps, you can
          >>> save the form as a report (File | Save As, in design view) to give you a
          >>> running start.
          >>>
          >>> You can then use the primary key value in the form to identify the
          >>> record to be printed. Example code in:
          >>> Print the record in the form
          >>> at:
          >>> http://allenbrowne.com/casu-15.html
          >>>
          >>> "John" <John@nospam.in fovis.co.uk> wrote in message
          >>> news:%23wHLCfr6 FHA.2616@TK2MSF TNGP15.phx.gbl. ..
          >>>>
          >>>> If I have a form open, what is the code that is equivalent to using the
          >>>> File->Print menu with select record(s) option to print the form with
          >>>> the currently displayed record values?[/color][/color]
          >
          >[/color]


          Comment

          • Allen Browne

            #6
            Re: Printing form with current record

            Try:
            RunCommand acPrint

            --
            Allen Browne - Microsoft MVP. Perth, Western Australia.
            Tips for Access users - http://allenbrowne.com/tips.html
            Reply to group, rather than allenbrowne at mvps dot org.

            "John" <John@nospam.in fovis.co.uk> wrote in message
            news:Cs2dnYBu9f JsQObeRVnyvQ@pi pex.net...[color=blue]
            > Thanks for this. Any way to select the printer and/or page orientation
            > before printing?
            >
            > "Allen Browne" <AllenBrowne@Se eSig.Invalid> wrote in message
            > news:437b4ff0$0 $9989$5a62ac22@ per-qv1-newsreader-01.iinet.net.au ...[color=green]
            >> Try:
            >> RunCommand acCmdSelectReco rd
            >> DoCmd.PrintOut acSelection
            >>
            >> I hate to even tell you how to do something that badly, though. :-)
            >>
            >>
            >> "John" <John@nospam.in fovis.co.uk> wrote in message
            >> news:jPGdnZuND9 3U0-benZ2dnUVZ8tydn Z2d@pipex.net.. .[color=darkred]
            >>>
            >>> Thanks for that but the client want a simple dump of the form with the
            >>> currently displayed record. I figured If I could automate the File-Print
            >>> command with Selected Record(s) option that'll do the trick.
            >>>
            >>> "Allen Browne" <AllenBrowne@Se eSig.Invalid> wrote in message
            >>> news:437b434b$0 $9956$5a62ac22@ per-qv1-newsreader-01.iinet.net.au ...
            >>>> In general, it's best to create a report for printing. You can then
            >>>> precisely control how the print should be laid out. If it helps, you
            >>>> can save the form as a report (File | Save As, in design view) to give
            >>>> you a running start.
            >>>>
            >>>> You can then use the primary key value in the form to identify the
            >>>> record to be printed. Example code in:
            >>>> Print the record in the form
            >>>> at:
            >>>> http://allenbrowne.com/casu-15.html
            >>>>
            >>>> "John" <John@nospam.in fovis.co.uk> wrote in message
            >>>> news:%23wHLCfr6 FHA.2616@TK2MSF TNGP15.phx.gbl. ..
            >>>>>
            >>>>> If I have a form open, what is the code that is equivalent to using
            >>>>> the File->Print menu with select record(s) option to print the form
            >>>>> with the currently displayed record values?[/color]
            >>
            >>[/color]
            >
            >[/color]


            Comment

            Working...