mad report.. =/

G

gr

Hello, I have a report which I thought was working
perfect.
When I click on the command button that opens it
everything works nice.
The problem shows out when I tried to print it. My nice
one page report come out in 24 pages! Everything was
printed more than once and one over the other making the
report complete unreadable! I used the Send To command and
the behavior is exactly the same...

any ideas?

The report builds an "index" it has 3 unbound text boxes
one for the DocumentName, DrawingNo and last for the Index
Number.
There might be more than one DocumentName and DrawingNo
for one Index Number. In the Left margin is placed the
Company Name and other data. Which I place on the Header
and set MoveLayout = False. in the same way is set to
False for the Details section.

The code is the following:

Option Compare Database
Option Explicit

Private Sub Detail_Format(Cancel As Integer, FormatCount
As Integer)
On Error GoTo DF_err
Dim intOpcion As Integer
Dim inti As Integer
inti = Me!RegisterNumber
Me.MoveLayout = False

'Vaciar Nombre del documento y numero de dibujo
If inti <= 12 Then
If IsNull(Me("txtReg" + Format(inti))) Then
Me("txtReg" + Format(inti)) = Me!DocName
Me("txtDwg" + Format(inti)) = Me!DrawingNo
Else
Me("txtReg" + Format(inti)) = Me("txtReg" + Format
(inti)) & vbCrLf & Me!DocName
Me("txtDwg" + Format(inti)) = Me("txtDwg" + Format
(inti)) & vbCrLf & Me!DrawingNo
End If
End If
If Me!txtLineNum = Me!txtTotalDetails Then
'Index Numbers
inti = 1
For inti = 1 To 12
Me("txtNo" + Format(inti)) = inti
Next inti
End If

If Me!txtLineNum = Me!txtTotalDetails Then
'All the info is now on the page so draw lines to separate
'one index number and info from the other
Dibuja_Linea12
End If

Salir_DF_err:
Exit Sub
DF_err:
MsgBox "Error " & Err.Number & ": " &
Err.Description
Resume Salir_DF_err
End Sub

Private Sub Dibuja_Linea12()
'Draws dividing lines
Dim X1 As Single, Y1 As Single
Dim X2 As Single, Y2 As Single
Dim Color As Long
Dim inty As Integer
Dim Offset As Single
'Set Offset
Offset = 57
'Width de la linea
X1 = 1862 ' Left
X2 = 8948 ' Total width
'Set el color
Color = RGB(0, 0, 0)
' Altura
inty = 2
For inty = 2 To 12
Y1 = Me("txtReg" + Format(inty)).Top - Offset
Y2 = Y1
'Dibujar Linea
Me.Line (X1, Y1)-(X2, Y2), Color
Next inty
End Sub

Private Sub ReportHeader_Format(Cancel As Integer,
FormatCount As Integer)
Me.MoveLayout = False
End Sub
 
G

gr

After more than 2 hours I found out that if I print the
report directly form VBA is printed perfect. The problem
is when clicking on Print or Send To from the Toolbar.

Does someone knows what's going on??

I changed:
If Me!cboRegisters <= 12 Then
DoCmd.OpenReport "rptRegister12", acViewPreview, ,
strCriteria
End If

For:
If Me!cboRegisters <= 12 Then
DoCmd.OpenReport "rptRegister12", acViewNormal, ,
strCriteria
End If


Any help will be greatly appreciated.
thx,
gr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top