I am building a quotation report with 4 text boxes in each record forming a line of item with price or a comment line without price.
Depending on the price line or comment line, I want to set the length of the item description to the maximum available width.
I built a code as below in the 'on print' event for the detail section but it is not accepting the value and stops with error message.
If I try to write the code in a control button from a different form, it does not work for each line but only for the top line in each page of the report printed.
I have tried writing the code in the event procedure for header and footer as well but same problem.
Where should I write this code to get it going properly?
Upper part of the code is for suppressing the sub-totals in footer when not required, which is working fine.
Problem is the bottom part which I tried at Open Form event but did not work.
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If Me.Code0 = "0" Or Me.Code0 = "8" Then
Me.Code0Footer.Visible = False
Else
Me.Code0Footer.Visible = True
End IfEnd Sub
Private Sub Report_Open(Cancel As Integer)
Dim a, b, c, d As Long
If IsNull(Me.Qty) Then
a = 0
b = 0
c = 9072
d = 0
Else
If Me.Qty = 1 Then
a = 0
b = 680
c = 7145
d = 1440
Else
a = 1418
b = 680
c = 5676
d = 1440
End If
End If
Me.TotalLP.Width = d
Me.QtySet.Width = b
Me.ULP.Width = a
Me.ItemDescription.Width = c
End Sub