A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to specify a printer via VB?



 
 
Thread Tools Display Modes
  #1  
Old February 6th, 2006, 09:29 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default How to specify a printer via VB?

I need to display a list of printers installed on a PC, and allow the user to
select one of them for a report. I need to be able to do this from VB (long
story). Can someone point me in the right direction?

Thanks a million!
  #2  
Old February 6th, 2006, 09:29 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default How to specify a printer via VB?

Check this link

http://www.mvps.org/access/reports/rpt0009.htm

--
\\// Live Long and Prosper \\//
BS"D


"Dennis" wrote:

I need to display a list of printers installed on a PC, and allow the user to
select one of them for a report. I need to be able to do this from VB (long
story). Can someone point me in the right direction?

Thanks a million!

  #3  
Old February 6th, 2006, 09:29 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default How to specify a printer via VB?

That link was helpful, but not exactly what I need. I need to display a list
of printers, and allow the user to select one . I don't need other printer
properties like paper type, page size, etc. Just a list of names. When the
user selects a name, that printer is used for the specific report. Access
2002.

Thanks!

"Ofer" wrote:

Check this link

http://www.mvps.org/access/reports/rpt0009.htm

--
\\// Live Long and Prosper \\//
BS"D


"Dennis" wrote:

I need to display a list of printers installed on a PC, and allow the user to
select one of them for a report. I need to be able to do this from VB (long
story). Can someone point me in the right direction?

Thanks a million!

  #4  
Old February 6th, 2006, 10:03 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default How to specify a printer via VB?

Create a form with a listbox on it and use the following code:

Private Sub Form_Load()
Dim intCounter As Integer

For intCounter = 0 To Application.Printers.Count - 1
Me.lstPrinters.AddItem Application.Printers(intCounter).DeviceName(),
intCounter
Next intCounter

End Sub

Dennis wrote:
That link was helpful, but not exactly what I need. I need to display a list
of printers, and allow the user to select one . I don't need other printer
properties like paper type, page size, etc. Just a list of names. When the
user selects a name, that printer is used for the specific report. Access
2002.

Thanks!

Check this link

[quoted text clipped - 5 lines]

Thanks a million!


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/200602/1
  #5  
Old February 6th, 2006, 10:31 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default How to specify a printer via VB?

Worked like a charm. Now, is there an easy way to set the selection as the
printer for that report ONLY?

Thanks!!

"Gina via AccessMonster.com" wrote:

Create a form with a listbox on it and use the following code:

Private Sub Form_Load()
Dim intCounter As Integer

For intCounter = 0 To Application.Printers.Count - 1
Me.lstPrinters.AddItem Application.Printers(intCounter).DeviceName(),
intCounter
Next intCounter

End Sub

Dennis wrote:
That link was helpful, but not exactly what I need. I need to display a list
of printers, and allow the user to select one . I don't need other printer
properties like paper type, page size, etc. Just a list of names. When the
user selects a name, that printer is used for the specific report. Access
2002.

Thanks!

Check this link

[quoted text clipped - 5 lines]

Thanks a million!


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/200602/1

  #6  
Old February 6th, 2006, 10:43 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default How to specify a printer via VB?

What I did in my application was included a second list box with the names of
the reports that the user could print then I used the following code to set
the printer and output the report.

Dim stDocName As String

stDocName = Me.lstReports.Value()

If Len(stDocName) 0 Then
'open the report in a hidden window
DoCmd.OpenReport stDocName, acViewPreview, , , acHidden

'set up printer
Reports(stDocName).Printer = Application.Printers(Me.lstPrinters.
ListIndex())
Reports(stDocName).Printer.Copies = Me.txtNumCopies.Value()

DoCmd.OpenReport stDocName, acNormal
End if

Its seems a bit convoluted, but it works. There is probably a much better way
of doing it.....

Gina

Dennis wrote:
Worked like a charm. Now, is there an easy way to set the selection as the
printer for that report ONLY?

Thanks!!

Create a form with a listbox on it and use the following code:

[quoted text clipped - 21 lines]

Thanks a million!


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/200602/1
  #7  
Old February 6th, 2006, 10:56 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default How to specify a printer via VB?

Thanks a million! That should do it!

"Gina via AccessMonster.com" wrote:

What I did in my application was included a second list box with the names of
the reports that the user could print then I used the following code to set
the printer and output the report.

Dim stDocName As String

stDocName = Me.lstReports.Value()

If Len(stDocName) 0 Then
'open the report in a hidden window
DoCmd.OpenReport stDocName, acViewPreview, , , acHidden

'set up printer
Reports(stDocName).Printer = Application.Printers(Me.lstPrinters.
ListIndex())
Reports(stDocName).Printer.Copies = Me.txtNumCopies.Value()

DoCmd.OpenReport stDocName, acNormal
End if

Its seems a bit convoluted, but it works. There is probably a much better way
of doing it.....

Gina

Dennis wrote:
Worked like a charm. Now, is there an easy way to set the selection as the
printer for that report ONLY?

Thanks!!

Create a form with a listbox on it and use the following code:

[quoted text clipped - 21 lines]

Thanks a million!


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ports/200602/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Default printer in Word 2002 Kendall General Discussion 3 November 29th, 2005 11:06 PM
Find out if report goes to a specific printer (re-post) Jon Ley Setting Up & Running Reports 5 November 24th, 2005 01:12 AM
define custom printer paper size KKAlll Visio 1 October 5th, 2005 09:30 PM
Checkbox Chip1035 Using Forms 9 April 6th, 2005 10:19 PM
Printing label printer (Zebra) AHopper Setting Up & Running Reports 0 November 22nd, 2004 09:41 PM


All times are GMT +1. The time now is 10:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.