I'm having some trouble figuring out why my print function isn't working correctly. It is designed to print out an inventory list. The very first column is supposed to be the UPC code. It prints the first line of inventory just the way it should(first line not counting the headers). But for every line after that, it prints the UPC code at the end of the line, instead of the beginning of the line, and I can't figure out why. In my code below, x_tab is used to set the columns. And y_pos is used to keep track of the current line being printed to. Hope you can help.
------------------Code:Do While Not Rs.EOF y_pos = Printer.CurrentY x_tab = 0 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
Ryan




Reply With Quote