Results 1 to 2 of 2

Thread: Printing Problem

  1. #1

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    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

  2. #2

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Ok, nevermind, I found the problem. I hate it when it's something so simple and obvious. But, anyway, the problem is that after I set the x_tab = 0 I never set the Printer.CurrentX = x_tab. So, then the UPC code gets printed at the end of the line.

    ------------------
    Ryan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width