กระทู้เก่าบอร์ด อ.Yeadram
1,044 2
URL.หัวข้อ /
URL
ปัญหาเกี่ยวกับการปริ้น Report โดยกำหนดเครื่องปริ้น
สวัสดีครับ อาจารย์ทุกท่าน
พอดีผมมีปัญหาเกี่ยวกับการสั่งปริ้น Report ปัญหาดังนี้ครับ
ผมมี Report อยู่ 3 ประเภทด้วยกัน แต่ละประเภท ปริ้นโดยเครื่องปริ้นคนละตัว
1. Report01 เป็นใบเสร็จ ต้องการปริ้น เครื่อง EPSON
2. Report02 เป็นเอกสารทั่วไป ปริ้นด้วยเครื่อง SAMSUNG
3. Report03 เป็นรูปภาพ ปริ้นด้วยเครื่อง CANNON
เราจะมีวิธีเขียนโค้ดอย่างไงบ้างครับ ที่กำหนดให้มันปริ้นที่เครื่องปริ้นที่เรากำหนดได้เลย
ขอบคุณครับ
พอดีผมมีปัญหาเกี่ยวกับการสั่งปริ้น Report ปัญหาดังนี้ครับ
ผมมี Report อยู่ 3 ประเภทด้วยกัน แต่ละประเภท ปริ้นโดยเครื่องปริ้นคนละตัว
1. Report01 เป็นใบเสร็จ ต้องการปริ้น เครื่อง EPSON
2. Report02 เป็นเอกสารทั่วไป ปริ้นด้วยเครื่อง SAMSUNG
3. Report03 เป็นรูปภาพ ปริ้นด้วยเครื่อง CANNON
เราจะมีวิธีเขียนโค้ดอย่างไงบ้างครับ ที่กำหนดให้มันปริ้นที่เครื่องปริ้นที่เรากำหนดได้เลย
ขอบคุณครับ
2 Reply in this Topic. Dispaly 1 pages and you are on page number 1
2 @R22016
ขอบคุณอาจารย์สันติสุขมากครับที่ให้คำแนะนำ
วิธีทำที่ผมใช้ก็ประมาณนี้ครับ ลองประยุคดูน่ะครับสำหรับท่านที่สนใจ
Private Sub Command01_Click()
Dim rpt As Report
Application.Printer = Application.Printers("EPSON") 'ชื่อเครื่องปริ้น
DoCmd.OpenReport "Report01", acViewPreview, , , acHidden
Set rpt = Reports!Report01
With rpt.Printer
.BottomMargin = 720
.Copies = 2
.Duplex = acPRDPVertical 'Double sided
.PaperBin = acPRBNLargeCapacity
End With
DoCmd.OpenReport "Report01", acViewNormal
DoCmd.Close acReport, "Report01", acSaveNo
Set Application.Printer = Nothing
End Sub
Private Sub Command02_Click()
Dim rpt As Report
Application.Printer = Application.Printers("SAMSUNG") 'ชื่อเครื่องปริ้น
DoCmd.OpenReport "Report02", acViewPreview, , , acHidden
Set rpt = Reports!Report02
With rpt.Printer
.BottomMargin = 720
.Copies = 2
.Duplex = acPRDPVertical 'Double sided
.PaperBin = acPRBNLargeCapacity
End With
DoCmd.OpenReport "Report02", acViewNormal
DoCmd.Close acReport, "Report02", acSaveNo
Set Application.Printer = Nothing
End Sub
Private Sub Command03_Click()
Dim rpt As Report
Application.Printer = Application.Printers("CANNON") 'ชื่อเครื่องปริ้น
DoCmd.OpenReport "Report03", acViewPreview, , , acHidden
Set rpt = Reports!Report03
With rpt.Printer
.BottomMargin = 720
.Copies = 2
.Duplex = acPRDPVertical 'Double sided
.PaperBin = acPRBNLargeCapacity
End With
DoCmd.OpenReport "Report03", acViewNormal
DoCmd.Close acReport, "Report03", acSaveNo
Set Application.Printer = Nothing
End Sub
วิธีทำที่ผมใช้ก็ประมาณนี้ครับ ลองประยุคดูน่ะครับสำหรับท่านที่สนใจ
Private Sub Command01_Click()
Dim rpt As Report
Application.Printer = Application.Printers("EPSON") 'ชื่อเครื่องปริ้น
DoCmd.OpenReport "Report01", acViewPreview, , , acHidden
Set rpt = Reports!Report01
With rpt.Printer
.BottomMargin = 720
.Copies = 2
.Duplex = acPRDPVertical 'Double sided
.PaperBin = acPRBNLargeCapacity
End With
DoCmd.OpenReport "Report01", acViewNormal
DoCmd.Close acReport, "Report01", acSaveNo
Set Application.Printer = Nothing
End Sub
Private Sub Command02_Click()
Dim rpt As Report
Application.Printer = Application.Printers("SAMSUNG") 'ชื่อเครื่องปริ้น
DoCmd.OpenReport "Report02", acViewPreview, , , acHidden
Set rpt = Reports!Report02
With rpt.Printer
.BottomMargin = 720
.Copies = 2
.Duplex = acPRDPVertical 'Double sided
.PaperBin = acPRBNLargeCapacity
End With
DoCmd.OpenReport "Report02", acViewNormal
DoCmd.Close acReport, "Report02", acSaveNo
Set Application.Printer = Nothing
End Sub
Private Sub Command03_Click()
Dim rpt As Report
Application.Printer = Application.Printers("CANNON") 'ชื่อเครื่องปริ้น
DoCmd.OpenReport "Report03", acViewPreview, , , acHidden
Set rpt = Reports!Report03
With rpt.Printer
.BottomMargin = 720
.Copies = 2
.Duplex = acPRDPVertical 'Double sided
.PaperBin = acPRBNLargeCapacity
End With
DoCmd.OpenReport "Report03", acViewNormal
DoCmd.Close acReport, "Report03", acSaveNo
Set Application.Printer = Nothing
End Sub
Time: 0.3212s
http://www.thai-access.com/yeadram_view.php?topic_id=165