Bom dia, estou gerando os relatórios no meu projeto seguindo este exemplo:
A consulta está ok, mas na hora de imprimir o relatório aparece o erro conforme a imagem.
Segue o script que está dando erro:
Sub OnReportStart
dim counter
counter = 2
set pgheader = Report.Sections(“PageHeader”)
set detail = Report.Sections(“Detail”)
set screen = Application.GetFrame(“Principal”).Screen
set check1 = screen.Item(“TE021”)
set check2 = screen.Item(“TE022”)
set check3 = screen.Item(“TE023”)
set check4 = screen.Item(“TE047”)
set check5 = screen.Item(“TE071”)
set check6 = screen.Item(“TE079”)
set check7 = screen.Item(“TE097”)
set check8 = screen.Item(“TE121”)
set check9 = screen.Item(“TE129”)
set check10 = screen.Item(“TE135”)
set check11 = screen.Item(“TE143”)
set check12 = screen.Item(“TE154”)
set check13 = screen.Item(“TE155”)
set check14 = screen.Item(“TE156”)
set check15 = screen.Item(“TE157”)
set check16 = screen.Item(“TE158”)
set check17 = screen.Item(“TE159”)
set check18 = screen.Item(“TE169”)
set check19 = screen.Item(“TE170”)
if check1.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE021”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE021”
counter = counter + 1
end if
if check2.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE022”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE022”
counter = counter + 1
end if
if check3.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE023”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE023”
counter = counter + 1
end if
if check4.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE047”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE047”
counter = counter + 1
end if
if check5.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE071”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE071”
counter = counter + 1
end if
if check6.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE079”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE079”
counter = counter + 1
end if
if check7.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE097”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE097”
counter = counter + 1
end if
if check8.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE121”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE121”
counter = counter + 1
end if
if check9.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE129”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE129”
counter = counter + 1
end if
if check10.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE135”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE135”
counter = counter + 1
end if
if check11.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE143”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE143”
counter = counter + 1
end if
if check12.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE154”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE154”
counter = counter + 1
end if
if check13.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE155”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE155”
counter = counter + 1
end if
if check14.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE156”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE156”
counter = counter + 1
end if
if check15.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE157”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE157”
counter = counter + 1
end if
if check16.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE158”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE158”
counter = counter + 1
end if
if check17.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE159”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE159”
counter = counter + 1
end if
if check18.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE169”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE169”
counter = counter + 1
end if
if check19.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TE170”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TE170”
end if
End Sub
Se alguém puder ajudar agradeço.