Welcome to SPN

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

Sign Up Now!

Changing report printer at runtime...

Discussion in 'Information Technology' started by Bertee, Jul 28, 2006.

  1. Bertee

    Bertee
    Expand Collapse
    Guest

    I currently have 4 invoice layouts which all have to be changed whenever an
    alteration is made. Each invoice prints to a different printer depending on
    if the invoice is in black & white, colour, needs to be faxed or needs to be
    e-mailed. I want to be able to use one layout & change the printer for the
    report at runtime. I have written some code which changes the default system
    printer to the one which has been setup for whatever type of invoice I want
    to print but access stores the name of the default printer and just prints to
    that rather than the actual system default printer. Is there any way of doing
    this? Thanks in advance for any help/suggestions.
     
  2. Loading...

    Similar Threads Forum Date
    S Asia Thinking about the big move: The Sikh way of life changing in Khyber-Pakhtunkhwa Breaking News Mar 22, 2014
    Opinion Haanji's Quick Takes on a Changing World (September 23, 2013) Breaking News Sep 22, 2013
    Changing my last name to Kaur... Questions and Answers May 15, 2013
    Life-changing Inspirational Stories Mar 31, 2013
    USA Sikhism and the Changing Electoral Demographic Breaking News Mar 8, 2013

  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    If you are using Access 2002 or 2003, you can set the Printer object before
    you OpenReport, and the report goes to that printer. This presumes that you
    have not specified a particular printer for the report at design time,
    under:
    File | Page Setup | Page | Default Printer

    For more detail, see:
    Printer Selection Utility
    at:
    http://allenbrowne.com/AppPrintMgt.html
    There is a downloadable sample database for A2002/2003, and links to article
    for Access 97 and 2000.

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

    "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    news:96D4D894-DE1B-44AB-9CF4-432F748A3589@microsoft.com...
    >I currently have 4 invoice layouts which all have to be changed whenever an
    > alteration is made. Each invoice prints to a different printer depending
    > on
    > if the invoice is in black & white, colour, needs to be faxed or needs to
    > be
    > e-mailed. I want to be able to use one layout & change the printer for the
    > report at runtime. I have written some code which changes the default
    > system
    > printer to the one which has been setup for whatever type of invoice I
    > want
    > to print but access stores the name of the default printer and just prints
    > to
    > that rather than the actual system default printer. Is there any way of
    > doing
    > this? Thanks in advance for any help/suggestions.
     
  4. Rainbow01

    Rainbow01
    Expand Collapse
    Guest

    from Rainbow01 Hong Kong

    first : make your custom tool bar, its contain icon to call the Access
    bulit-in printing menu
    second : when open your report, also to show the above tool bar for user to
    choose printer

    "Bertee" 來函:

    > I currently have 4 invoice layouts which all have to be changed whenever an
    > alteration is made. Each invoice prints to a different printer depending on
    > if the invoice is in black & white, colour, needs to be faxed or needs to be
    > e-mailed. I want to be able to use one layout & change the printer for the
    > report at runtime. I have written some code which changes the default system
    > printer to the one which has been setup for whatever type of invoice I want
    > to print but access stores the name of the default printer and just prints to
    > that rather than the actual system default printer. Is there any way of doing
    > this? Thanks in advance for any help/suggestions.
     
  5. Bertee

    Bertee
    Expand Collapse
    Guest

    I am using Access 2003 & the printer is set to default printer. When I change
    the system default printer to, say, WinFax Access doesn't print to that it
    prints to the default printer set at the time of design.

    "Allen Browne" wrote:

    > If you are using Access 2002 or 2003, you can set the Printer object before
    > you OpenReport, and the report goes to that printer. This presumes that you
    > have not specified a particular printer for the report at design time,
    > under:
    > File | Page Setup | Page | Default Printer
    >
    > For more detail, see:
    > Printer Selection Utility
    > at:
    > http://allenbrowne.com/AppPrintMgt.html
    > There is a downloadable sample database for A2002/2003, and links to article
    > for Access 97 and 2000.
    >
    > --
    > 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.
    >
    > "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    > news:96D4D894-DE1B-44AB-9CF4-432F748A3589@microsoft.com...
    > >I currently have 4 invoice layouts which all have to be changed whenever an
    > > alteration is made. Each invoice prints to a different printer depending
    > > on
    > > if the invoice is in black & white, colour, needs to be faxed or needs to
    > > be
    > > e-mailed. I want to be able to use one layout & change the printer for the
    > > report at runtime. I have written some code which changes the default
    > > system
    > > printer to the one which has been setup for whatever type of invoice I
    > > want
    > > to print but access stores the name of the default printer and just prints
    > > to
    > > that rather than the actual system default printer. Is there any way of
    > > doing
    > > this? Thanks in advance for any help/suggestions.

    >
    >
    >
     
  6. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    Make sure you have unchecked the boxes under:
    Tools | Options | General | Name AutoCorrect
    Then compact the database.
    This is known to cause problems with report settings (amongst a couple of
    dozen other things.)

    There is a difference between hard coding the report to use a specific
    printer rather than leaving it on default printer, even if the printer you
    specified is the same as the default printer at design time.

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

    "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    news:E467AC4B-AA49-442D-A734-4450B64894E3@microsoft.com...
    >I am using Access 2003 & the printer is set to default printer. When I
    >change
    > the system default printer to, say, WinFax Access doesn't print to that it
    > prints to the default printer set at the time of design.
    >
    > "Allen Browne" wrote:
    >
    >> If you are using Access 2002 or 2003, you can set the Printer object
    >> before
    >> you OpenReport, and the report goes to that printer. This presumes that
    >> you
    >> have not specified a particular printer for the report at design time,
    >> under:
    >> File | Page Setup | Page | Default Printer
    >>
    >> For more detail, see:
    >> Printer Selection Utility
    >> at:
    >> http://allenbrowne.com/AppPrintMgt.html
    >> There is a downloadable sample database for A2002/2003, and links to
    >> article
    >> for Access 97 and 2000.
    >>
    >> "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    >> news:96D4D894-DE1B-44AB-9CF4-432F748A3589@microsoft.com...
    >> >I currently have 4 invoice layouts which all have to be changed whenever
    >> >an
    >> > alteration is made. Each invoice prints to a different printer
    >> > depending
    >> > on
    >> > if the invoice is in black & white, colour, needs to be faxed or needs
    >> > to
    >> > be
    >> > e-mailed. I want to be able to use one layout & change the printer for
    >> > the
    >> > report at runtime. I have written some code which changes the default
    >> > system
    >> > printer to the one which has been setup for whatever type of invoice I
    >> > want
    >> > to print but access stores the name of the default printer and just
    >> > prints
    >> > to
    >> > that rather than the actual system default printer. Is there any way of
    >> > doing
    >> > this? Thanks in advance for any help/suggestions.
     
  7. Bertee

    Bertee
    Expand Collapse
    Guest

    I have unchecked the box and compacted the database but no difference. To
    clarify, I have 1 report which I would like to print on 4 various printers
    depending on option taken at time of print. The report is set through File ->
    Page Setup -> Page to print to the default printer. I have a parameters form
    which I setup the device/driver/port for the 5 types of printers to use (1
    being the default to reset the default system printer to once printing has
    been completed). When the report is printed it does change the system default
    printer to the one I would like to use for that type of print BUT Access
    doesn't just print it to the system default printer. It knows that the
    report, at runtime, was formatted to print on a specific printer despite the
    fact that the page was not set to print to that specific printer at any time
    during design.

    "Allen Browne" wrote:

    > Make sure you have unchecked the boxes under:
    > Tools | Options | General | Name AutoCorrect
    > Then compact the database.
    > This is known to cause problems with report settings (amongst a couple of
    > dozen other things.)
    >
    > There is a difference between hard coding the report to use a specific
    > printer rather than leaving it on default printer, even if the printer you
    > specified is the same as the default printer at design time.
    >
    > --
    > 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.
     
  8. Bertee

    Bertee
    Expand Collapse
    Guest

    Quick update, Access prints to the default printer at the time of starting
    the database. For instance, if the default printer is Adobe PDF when the
    database is opened and my code changes the system default printer to WinFax
    for the report to be faxed Access still prints to Adobe PDF. Does Access
    check for the default printer before a report is printed or only at the time
    the database is opened?
     
  9. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    In Access 2002 and 2003, the printer that will be used is defined by the
    Printer object (assuming it is not saved for a specific printer.)

    When you start Access, this object is initialized to the Windows default
    printer. If you want Access to use a different Printer as its default,
    assign it to the Printer object, from the Printers collection.

    That assignment must be made before the report is opened (i.e. you cannot
    make the assignment in Report_Open when you OpenReport with acViewNormal.)

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

    "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    news:1B855796-F49D-4FF0-B65E-6BBA29688357@microsoft.com...
    > Quick update, Access prints to the default printer at the time of starting
    > the database. For instance, if the default printer is Adobe PDF when the
    > database is opened and my code changes the system default printer to
    > WinFax
    > for the report to be faxed Access still prints to Adobe PDF. Does Access
    > check for the default printer before a report is printed or only at the
    > time
    > the database is opened?
     
  10. Bertee

    Bertee
    Expand Collapse
    Guest

    So I cannot just change the windows default printer?

    "Allen Browne" wrote:

    > In Access 2002 and 2003, the printer that will be used is defined by the
    > Printer object (assuming it is not saved for a specific printer.)
    >
    > When you start Access, this object is initialized to the Windows default
    > printer. If you want Access to use a different Printer as its default,
    > assign it to the Printer object, from the Printers collection.
    >
    > That assignment must be made before the report is opened (i.e. you cannot
    > make the assignment in Report_Open when you OpenReport with acViewNormal.)
    >
    > --
    > 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.
    >
    > "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    > news:1B855796-F49D-4FF0-B65E-6BBA29688357@microsoft.com...
    > > Quick update, Access prints to the default printer at the time of starting
    > > the database. For instance, if the default printer is Adobe PDF when the
    > > database is opened and my code changes the system default printer to
    > > WinFax
    > > for the report to be faxed Access still prints to Adobe PDF. Does Access
    > > check for the default printer before a report is printed or only at the
    > > time
    > > the database is opened?

    >
    >
    >
     
  11. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    Bertee, did you try assigning the Printer object yet?

    That was what was suggested to you in the first reply.
    I think that's as far as I will take this thread.

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

    "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    news:D5EF8C7F-130C-4FED-85F6-045206FD1D71@microsoft.com...
    > So I cannot just change the windows default printer?
    >
    > "Allen Browne" wrote:
    >
    >> In Access 2002 and 2003, the printer that will be used is defined by the
    >> Printer object (assuming it is not saved for a specific printer.)
    >>
    >> When you start Access, this object is initialized to the Windows default
    >> printer. If you want Access to use a different Printer as its default,
    >> assign it to the Printer object, from the Printers collection.
    >>
    >> That assignment must be made before the report is opened (i.e. you cannot
    >> make the assignment in Report_Open when you OpenReport with
    >> acViewNormal.)
    >>
    >> "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    >> news:1B855796-F49D-4FF0-B65E-6BBA29688357@microsoft.com...
    >> > Quick update, Access prints to the default printer at the time of
    >> > starting
    >> > the database. For instance, if the default printer is Adobe PDF when
    >> > the
    >> > database is opened and my code changes the system default printer to
    >> > WinFax
    >> > for the report to be faxed Access still prints to Adobe PDF. Does
    >> > Access
    >> > check for the default printer before a report is printed or only at the
    >> > time
    >> > the database is opened?
     
  12. Bertee

    Bertee
    Expand Collapse
    Guest

    I will try that as soon as I work out how. Thanks for help with this.
    Hopefully it will be simpler to do in the new version of Access.

    "Allen Browne" wrote:

    > Bertee, did you try assigning the Printer object yet?
    >
    > That was what was suggested to you in the first reply.
    > I think that's as far as I will take this thread.
    >
    > --
    > 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.
    >
    > "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    > news:D5EF8C7F-130C-4FED-85F6-045206FD1D71@microsoft.com...
    > > So I cannot just change the windows default printer?
    > >
    > > "Allen Browne" wrote:
    > >
    > >> In Access 2002 and 2003, the printer that will be used is defined by the
    > >> Printer object (assuming it is not saved for a specific printer.)
    > >>
    > >> When you start Access, this object is initialized to the Windows default
    > >> printer. If you want Access to use a different Printer as its default,
    > >> assign it to the Printer object, from the Printers collection.
    > >>
    > >> That assignment must be made before the report is opened (i.e. you cannot
    > >> make the assignment in Report_Open when you OpenReport with
    > >> acViewNormal.)
    > >>
    > >> "Bertee" <Bertee@discussions.microsoft.com> wrote in message
    > >> news:1B855796-F49D-4FF0-B65E-6BBA29688357@microsoft.com...
    > >> > Quick update, Access prints to the default printer at the time of
    > >> > starting
    > >> > the database. For instance, if the default printer is Adobe PDF when
    > >> > the
    > >> > database is opened and my code changes the system default printer to
    > >> > WinFax
    > >> > for the report to be faxed Access still prints to Adobe PDF. Does
    > >> > Access
    > >> > check for the default printer before a report is printed or only at the
    > >> > time
    > >> > the database is opened?

    >
    >
    >
     

Share This Page