Welcome to SPN

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

Sign Up Now!
  1. Guest ji, please consider donating today!   Become a Supporter    ::   Make a Contribution   
    Monthly (Recurring) Target: $300 :: Achieved: $95

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?

    >>
    >>

    >
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page