Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Printing form with current record

Discussion in 'Information Technology' started by John, Nov 17, 2005.

  1. John

    John
    Expand Collapse
    Guest

    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
     
  2. Loading...


  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    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.infovis.co.uk> wrote in message
    news:%23wHLCfr6FHA.2616@TK2MSFTNGP15.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?
     
  4. John

    John
    Expand Collapse
    Guest

    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@SeeSig.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
    >
    > --
    > 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.infovis.co.uk> wrote in message
    > news:%23wHLCfr6FHA.2616@TK2MSFTNGP15.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?

    >
    >
     
  5. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    Try:
    RunCommand acCmdSelectRecord
    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.infovis.co.uk> wrote in message
    news:jPGdnZuND93U0-benZ2dnUVZ8tydnZ2d@pipex.net...
    >
    > 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@SeeSig.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.infovis.co.uk> wrote in message
    >> news:%23wHLCfr6FHA.2616@TK2MSFTNGP15.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?
     
  6. John

    John
    Expand Collapse
    Guest

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

    "Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
    news:437b4ff0$0$9989$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
    > Try:
    > RunCommand acCmdSelectRecord
    > 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.infovis.co.uk> wrote in message
    > news:jPGdnZuND93U0-benZ2dnUVZ8tydnZ2d@pipex.net...
    >>
    >> 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@SeeSig.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.infovis.co.uk> wrote in message
    >>> news:%23wHLCfr6FHA.2616@TK2MSFTNGP15.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?

    >
    >
     
  7. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    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.infovis.co.uk> wrote in message
    news:Cs2dnYBu9fJsQObeRVnyvQ@pipex.net...
    > Thanks for this. Any way to select the printer and/or page orientation
    > before printing?
    >
    > "Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
    > news:437b4ff0$0$9989$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
    >> Try:
    >> RunCommand acCmdSelectRecord
    >> DoCmd.PrintOut acSelection
    >>
    >> I hate to even tell you how to do something that badly, though. :)
    >>
    >>
    >> "John" <John@nospam.infovis.co.uk> wrote in message
    >> news:jPGdnZuND93U0-benZ2dnUVZ8tydnZ2d@pipex.net...
    >>>
    >>> 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@SeeSig.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.infovis.co.uk> wrote in message
    >>>> news:%23wHLCfr6FHA.2616@TK2MSFTNGP15.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?

    >>
    >>

    >
    >
     

Share This Page