|
-
May 1st, 2003, 04:49 PM
#1
Thread Starter
Fanatic Member
[Resolved] Change printer in Access 2000
I am using the following code on a command button in an Access 2000 program.
Code:
Dim x As Printer
For Each x In Printers
If x.DeviceName = "Acrobat Distiller" Then
Set Printer = x
Exit For
End If
Next
DoCmd.OpenReport "Prop_Invoice_Email", acViewPreview, , "Month(Inv_Statement_Date) = " _
& Format(Month(dteStatementDate), "00") & " And Year(Inv_Statement_Date) = " & _
Format(Year(dteStatementDate), "00")
DoCmd.PrintOut acPrintAll, , , acHigh
I want this report to print out to my Acrobat Distiller printout but it is printing to my system default printer.
Anyone have any ideas why this is happening?
Thanks
Last edited by indydavid32; Jun 30th, 2003 at 11:56 AM.
David Wilhelm
-
May 5th, 2003, 12:07 PM
#2
Thread Starter
Fanatic Member
Bump
-
May 6th, 2003, 09:18 AM
#3
Thread Starter
Fanatic Member
Help!
Can anyone answer this?
Anyone at all?
PLEASE!
-
May 7th, 2003, 08:19 AM
#4
Thread Starter
Fanatic Member
-
May 7th, 2003, 09:18 AM
#5
Frenzied Member
you have to set the default printer to your choice , print the report and reset the default printer.
Or you have to set the printer in the report to this printer.
If no special printer is set in the report it prints to the default printer.
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
-
May 7th, 2003, 09:21 AM
#6
Thread Starter
Fanatic Member
I am setting the printer
If you look at my first post, you can see that I am trying to set the printer to the Acrobat Distiller.
When I print my report, it does not print to the Acrobat Distiller, it prints to my system default printer.
That was my question, why is it doing this.
-
May 7th, 2003, 09:49 AM
#7
Frenzied Member
I don't think you can set the printer like that.
You need to set the currentdevice in de deviceslist to that printer.
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
-
May 8th, 2003, 08:48 AM
#8
Thread Starter
Fanatic Member
Bueler?.... Bueler?....Bueler?.....Bueler?
Can anyone give a definite answer why my code won't work and an example of some code that does work?
Thanks
-
May 16th, 2003, 09:39 AM
#9
Thread Starter
Fanatic Member
Bump
Surely someone knows the answer to this.
-
May 16th, 2003, 10:17 AM
#10
PowerPoster
I have a coupe report that just use printer.printy. However this is the code they use to sdelect the printer:
' MsgBox "Set default printer to server. Make sure paper size is set to FANFOLD1.", vbInformation
' CommonDialog1.ShowPrinter
SCREEN.MousePointer = vbHourglass
Printer.Orientation = vbPRORLandscape
MonthlyActivity
Printer.Orientation = vbPRORLandscape
MonthlyActivity2
SCREEN.MousePointer = 0
Printer.Orientation = vbPRORPortrait
' MsgBox "Set default printer back to what it was.", vbInformation
' CommonDialog1.ShowPrinter
-
May 16th, 2003, 10:19 AM
#11
PowerPoster
Also, have you used the debug to see what printer names it is actually finding? If it doesn't find the name you have specified, it will go to the default. By the way, forget the comment marks on the previous post before the commondialog statement.
-
May 27th, 2003, 07:57 AM
#12
New Member
Try this:
Dim stDocName As String
Dim x As Printer
'Set the printer default
Set Application.Printer = Application.Printers("Acrobat Distiller")
Set x = Application.Printer
'Opens Prop Invoice Email in preview mode and then sets the reports printer to above printer
stDocName = "Prop Invoice Email"
DoCmd.OpenReport stDocName, acPreview, , , acWindowNormal
Reports(stDocName).Printer = x
DoCmd.PrintOut acPrintAll, , , acHigh
When you set the Application.Printer you may require the full UNC path.
Any problems let me know.
-
Jun 5th, 2003, 03:04 AM
#13
New Member
-
Jun 30th, 2003, 11:55 AM
#14
Thread Starter
Fanatic Member
Went another way
Hi, thanks for your post. I don't know if it worked or not. I went another way.
Instead of using the distiller, I am exporting it directly to a file using the following code using my VB code.
VB Code:
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
Report.Database.Tables(1).SetLogOnInfo "12.23.12.12", "Monthly Invoices", "sa", ""
Report.DiscardSavedData
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
CRViewer1.Zoom 90
Report.SaveAs "C:\Statement.rpt", cr80FileFormat
Dim objCrstal As New CRAXDRT.Application
Dim objReport As New CRAXDRT.Report
Dim objExportOptions As CRAXDRT.ExportOptions
Set objCrystal = New CRAXDRT.Application
Set objReport = objCrystal.OpenReport("C:\Statement.rpt", 0)
Set objExportOptions = objReport.ExportOptions
With objExportOptions
.DestinationType = crEDTDiskFile
.DiskFileName = "C:\Statement.pdf"
.FormatType = crEFTPortableDocFormat
.PDFExportAllPages = True
End With
objReport.Export False
Set objReport = Nothing
Set objCrystal = Nothing
Screen.MousePointer = vbDefault
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|