Erro ao gerar relatório

Boa noite, estou com um erro quando vou gerar o relatório e não consigo entender o que está acontecendo, seguem as imagens dos scripts, se alguém puder me auxiliar eu agradeço:
Script do relatório:


O nome do Datafield está igual ao histórico e ao banco:



Script do botão que chama o relatório:
05
O erro que aparece:

Bom dia @patricia,

O erro está na linha
screen = Application.GetFrame().Screen

Falta o parâmetro do nome do quadro.

Tente alterar o script para
screen = Application.GetFrame("").Screen

Ou forneça o nome do quadro correto.

Boa tarde, mesmo assim não funciona e continua o mesmo erro.

Se a tela está em um quadro, você tem que colocar o nome do divisor do quadro no comando.
Exemplo:
screen = Application.GetFrame(“DivisorInferior”).Screen

Boa tarde, está no quadro com nome: “Inferior”, também já fiz esse teste e não funcionou, continua exatamente o mesmo erro

Infelizmente continua dando o mesmo erro e na mesma linha, mesmo com a linha corrigida:

Boa tarde @patricia,

Você pode compartilhar o script inteiro em forma de texto?

Boa tarde, o script que está dentro do relatório?

	Set objFrameSet = Application.GetObject("Quadro1.Divisor1.Inferior")
	Set objScreen = Application.GetObject( objFrameSet.SplitLink )

Sim. O script do relatório.

Sub OnReportStart
dim counter
counter = 2
set pgheader = Report.Sections(“PageHeader”)
set detail = Report.Sections(“Detail”)
set screen = Application.GetFrame(“Inferior”).Screen
set check1 = screen.Item(“TUNEL01”)
set check2 = screen.Item(“TUNEL02”)
set check3 = screen.Item(“TUNEL03”)
set check4 = screen.Item(“TUNEL04”)
set check5 = screen.Item(“TUNEL05”)
set check6 = screen.Item(“TUNEL06”)
set check7 = screen.Item(“TUNEL07”)
set check8 = screen.Item(“TUNEL08”)
set check9 = screen.Item(“TUNEL09”)
set check10 = screen.Item(“TUNEL10”)
set check11 = screen.Item(“TUNEL11”)
set check12 = screen.Item(“DESOSSA”)
set check13 = screen.Item(“CE01”)
set check14 = screen.Item(“CE02”)
set check15 = screen.Item(“CMC01”)
set check16 = screen.Item(“CMC02”)
set check17 = screen.Item(“CMC03”)
set check18 = screen.Item(“CRC01”)
set check19 = screen.Item(“CRC02”)
set check20 = screen.Item(“CRC03”)
set check21 = screen.Item(“CRC04”)
set check22 = screen.Item(“CRC05”)
set check23 = screen.Item(“CRC06”)
set check24 = screen.Item(“CRC07”)
set check25 = screen.Item(“CRC08”)
set check26 = screen.Item(“CRC09”)
set check27 = screen.Item(“CRC10”)
set check28 = screen.Item(“CRC16”)
set check29 = screen.Item(“CRC17”)

if check1.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL01”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL01”
counter = counter + 1
end if

if check2.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL02”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL02”
counter = counter + 1
end if

if check3.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL03”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL03”
counter = counter + 1
end if

if check4.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL04”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL04”
counter = counter + 1
end if

if check5.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL05”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL05”
counter = counter + 1
end if

if check6.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL06”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL06”
counter = counter + 1
end if

if check7.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL07”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL07”
counter = counter + 1
end if

if check8.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL08”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL08”
counter = counter + 1
end if

if check9.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL09”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL09”
counter = counter + 1
end if

if check10.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL10”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL10”
counter = counter + 1
end if

if check11.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “TUNEL11”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “TUNEL11”
counter = counter + 1
end if

if check12.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “DESOSSA”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “DESOSSA”
counter = counter + 1
end if

if check13.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CE01”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CE01”
counter = counter + 1
end if

if check14.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CE02”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CE02”
counter = counter + 1
end if

if check15.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CMC01”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CMC01”
counter = counter + 1
end if

if check16.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CMC02”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CMC02”
counter = counter + 1
end if

if check17.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CMC03”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CMC03”
counter = counter + 1
end if

if check18.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC01”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC01”
counter = counter + 1
end if

if check19.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC02”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC02”
end if

if check20.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC03”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC03”
counter = counter + 1
end if

if check21.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC04”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC04”
end if

if check22.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC05”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC05”
counter = counter + 1
end if

if check23.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC06”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC06”
end if

if check24.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC07”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC07”
counter = counter + 1
end if

if check25.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC08”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC08”
end if

if check26.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC09”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC09”
counter = counter + 1
end if

if check27.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC10”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC10”
end if

if check28.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC16”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC16”
counter = counter + 1
end if

if check29.Value then
detail.Controls(“Field” & CStr(counter)).Visible = true
detail.Controls(“Field” & CStr(counter)).DataField = “CRC17”
pgheader.Controls(“Label” & CStr(counter)).Visible = true
pgheader.Controls(“Label” & CStr(counter)).Caption = “CRC17”
end if

End Sub

Boa tarde, obrigado! Mas também dá erro.

@patricia,

O script está correto. Você atualizou o domínio após salvar as alterações?

Sim, o pior é que não é a primeira vez que faço esse tipo de relatório(e que funciona), simplesmente não encontro o erro, obrigado pela ajuda.

Pela natureza do script que você utilizou, você não consegue testar o relatório sem ser pela tela em questão.

O erro, na realidade é na linha:

set check1 = screen.Item("TUNEL01")

De fato existe o objeto TUNEL01 na tela em questão?

Existe o DataField com esse nome, e é o mesmo no histórico e na tabela do banco.

Certo, mas a Tela que abre no seu divisor Inferior possui um Item chamado TUNEL01?

image

É esse mesmo o erro, procurei em um monte de lugar e esqueci do óbvio. Muito obrigado.