Problemmer med udskrivning
HJÆLP!!!Følgene kode skriver en brugerliste ud på en printer.
problemmet er at hvert navn kommer ud på en side for sig.
jeg har kigget koden igennem tusindvis af gange men jeg kan ikke finde fejlen.
koden er:
nrData = DBConOW.Recordset.RecordCount
Printer.PrintQuality = -4
Dim i As Integer \'to be used for the for...next loop
Dim R As Integer \'to be used to incement the row number
Dim IncreaseY As Integer \'to be used to increase Y coordinate
\'
Printer.ScaleMode = 6 \'declare measurement units
\'
Printer.CurrentX = 10 \'declare position of X
Printer.CurrentY = 10 \'declare position of Y
DBGrid1.Col = 0 \'identify column number to print
DBGrid1.Row = 0 \'identify row number to print
Printer.Print DBGrid1.Text
Printer.Line (9, 10)-(9, 15 + 9 * 5) \'vertical line 1
\'
DBGrid1.Col = 1 \'identify column number to print
Printer.CurrentX = 20 \'declare new position of Y
Printer.CurrentY = 10 \'declare position of Y
Printer.Print DBGrid1.Text
Printer.Line (19, 10)-(19, 15 + 9 * 5) \'vertical line 2
\'
DBGrid1.Col = 2 \'identify column number to print
Printer.CurrentX = 70 \'declare new position of Y
Printer.CurrentY = 10 \'declare position of Y
Printer.Print DBGrid1.Text
Printer.Line (69, 10)-(69, 15 + 9 * 5) \'vertical line 3
Printer.Line (85, 10)-(85, 15 + 9 * 5) \'vertical line 4
\'Set this variable to 0 everytime you press print
IncreaseY = 0
\'Print more Rows
For i = 1 To (nrData - 1) \'OR DBGrid1.VisibleRows
R = R + 1 \'row number by increase one with every loop
IncreaseY = IncreaseY + 5 \'increaseY by 5 with every loop
\'
On Error Resume Next
DBGrid1.Row = R \'identify row number to print
If Err.Number = 6148 Then
DBConOW.Recordset.MoveNext
End If
Printer.CurrentX = 10 \'declare same position of X
Printer.CurrentY = 10 + IncreaseY \'declare position of Y
DBGrid1.Col = 0 \'identify column number to print
Printer.Print DBGrid1.Text
\'
DBGrid1.Col = 1 \'identify column number to print
Printer.CurrentX = 20 \'declare new position of Y
Printer.CurrentY = 10 + IncreaseY \'declare position of Y
s
DBGrid1.Col = 2 \'identify column number to print
Printer.CurrentX = 70 \'declare new position of Y
Printer.CurrentY = 10 + IncreaseY \'declare position of Y
Printer.Print DBGrid1.Text
Next
\'Print Horizontal Lines
Dim j As Integer \'to be used to draw horizontal line
Dim Counter As Integer \'to increase the value of Y
\'
For j = 1 To (nrData + 1) \'all the rows, 1 extra before row one and 1 after the last row, 9+2=11
Counter = Counter + 5
Printer.Line (9, 5 + Counter)-(85, 5 + Counter)
Next j
Printer.EndDoc
Håber der er nogle der kan hjælpe.
V.H
Henrik Kragegaard