I've been looking through the MSDN files, and all I found was something about the Orientation property of the CommonDialog window. I tried setting that equal to cdlLandscape but that didn't work. Do I need to change my code too? Here is my code:
------------------Code:Dim Rs2 As ADODB.Recordset Dim x As Long Dim y As Integer Dim CurrentPage As Integer Dim x_width As Integer Dim x_tab As Integer Dim y_pos As Integer Dim Bookmark As String Dim CopyCounter As Integer Dim LinesPerPage As Integer Set Rs2 = Connection.Execute("SELECT COUNT(*) FROM Inventory") LinesPerPage = Printer.ScaleHeight \ Printer.TextHeight(" ") x_width = 110 x = Rs2.Fields(0).Value CommonDialog1.min = 1 CommonDialog1.Max = x \ LinesPerPage + IIf(x Mod LinesPerPage > 0, 1, 0) CommonDialog1.Flags = cdlPDNoSelection Or cdlPDHidePrintToFile On Error GoTo ERROR CommonDialog1.CancelError = True CommonDialog1.ShowPrinter CommonDialog1.Orientation = cdlLandscape Bookmark = Rs.Fields("product_id").Value For CopyCounter = 1 To CommonDialog1.Copies Rs.MoveFirst y_pos = Printer.CurrentY x_tab = 0 CurrentPage = 1 Printer.Print "UPC" Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtupc.MaxLength + 1) x_tab = Printer.CurrentX Printer.Print "Description" Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtdescription.MaxLength + 1) x_tab = Printer.CurrentX Printer.Print "Cost" Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtcost.MaxLength + 1) x_tab = Printer.CurrentX Printer.Print "QOH" Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtqoh.MaxLength + 1) x_tab = Printer.CurrentX Printer.Print "Vendor" Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtvendor.MaxLength + 1) x_tab = Printer.CurrentX Printer.Print "Vendor Code" Rs.MoveFirst If CurrentPage < CommonDialog1.FromPage Then Rs.Move (LinesPerPage * (CommonDialog1.FromPage - 1) - 1) CurrentPage = CommonDialog1.FromPage End If x_tab = 0 Do While Not Rs.EOF y_pos = Printer.CurrentY x_tab = 0 Printer.CurrentX = x_tab Printer.Print Rs.Fields("upc").Value Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtupc.MaxLength + 1) x_tab = Printer.CurrentX Printer.Print Rs.Fields("description").Value Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtdescription.MaxLength + 1) x_tab = Printer.CurrentX Printer.CurrentX = x_tab + x_width * (txtcost.MaxLength) - Printer.TextWidth(Rs.Fields("cost").Value) Printer.Print Rs.Fields("cost").Value Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtcost.MaxLength + 1) x_tab = Printer.CurrentX Printer.Print Rs.Fields("qoh").Value Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtqoh.MaxLength + 1) x_tab = Printer.CurrentX Printer.Print Rs.Fields("vendor").Value Printer.CurrentY = y_pos Printer.CurrentX = x_tab + x_width * (txtvendor.MaxLength + 1) x_tab = Printer.CurrentX Printer.Print Rs.Fields("vendor_code").Value Printer.CurrentX = x_tab + x_width * (txtvendor_code.MaxLength + 1) Rs.MoveNext If Printer.CurrentY >= (Printer.ScaleHeight - Printer.TextHeight(" ")) And Not Rs.EOF Then If CurrentPage = CommonDialog1.ToPage And (CommonDialog1.Flags And cdlPDPageNums) Then Exit Do End If Printer.NewPage CurrentPage = CurrentPage + 1 End If Loop Printer.EndDoc Next CopyCounter Rs.MoveFirst Rs.Find ("product_id = '" & Bookmark & "'") Exit Sub ERROR: Exit Sub End Sub
Ryan
------------------
Ryan




Reply With Quote