Erro de violation no relatório...ao executar na segunda vez!
Na primeira vez que eu executo o relatório dá tudo certo, mas quando eu vou rodar ele de novo ele dá esse erro:
esse é o meu codigo fonte :
Access violation at address 00404AA0 in nodule ´sistemacfc.exe´. Write of address 00000244.
esse é o meu codigo fonte :
var frmLisRelPraSemanais: TfrmLisRelPraSemanais; data, HorIni, HorFin, aluno, Inst, Cat :TQRLabel; i, a, b, c, d, e, Cont, soma, x, y, z :integer; SomaData, HrF : Integer; implementation uses fdtmiza, FRelPraSemanal, Praticas, FRelSemanal, IBQuery, FPrincipal, FPesquisa, funcoes; {$R *.dfm} procedure TfrmLisRelPraSemanais.spbfecClick(Sender: TObject); begin Close; end; procedure TfrmLisRelPraSemanais.spbexiClick(Sender: TObject); begin Application.CreateForm(TQrSemanal,QrSemanal); // Coluna das Datas for i:=1 to 7 do begin data := TQRLabel.Create(self); data.Name := ´Dat´+inttostr(i); data.Left := -40+(i*135); data.top := 50; data.Frame.DrawTop := true; data.Frame.DrawBottom := true; data.Frame.DrawLeft := true; data.Frame.DrawRight := true; data.Transparent := true; data.Width := 130; data.Font.Size := 12; data.Height := 21; data.Font.Name := ´Arial´; data.Font.Style := [fsBold]; data.AutoSize := false; data.Caption := DateToStr(DataInicial.Date-1 + i); data.Alignment := TaCenter; data.Parent := QrSemanal.QRBand1; end; // coluna de horarios for a:=1 to 16 do begin HorIni := TQRLabel.Create(self); HorIni.Name := ´Hor´+inttostr(a); HorIni.Left := 4; HorIni.Height := 23; HorIni.Frame.DrawTop := true; HorIni.Frame.DrawBottom := true; HorIni.Frame.DrawLeft := true; HorIni.Frame.DrawRight := true; HorIni.Transparent := true; HorIni.AutoSize := false; HorIni.Width := 43; HorIni.Font.Size := 10; HorIni.Font.Name := ´Arial´; HorIni.Font.Style := [fsBold]; // hora.Caption := inttostr(6+a)+´:00´; HorIni.Caption := ´´; HorIni.Alignment := tacenter; HorIni.top := 50+(a*25); HorIni.Parent := QrSemanal.QRBand1; end; // coluna de horarios for HrF:=1 to 16 do begin HorFin := TQRLabel.Create(self); HorFin.Name := ´HorFin´+inttostr(HrF); HorFin.Left := 50; HorFin.Height := 23; HorFin.Frame.DrawTop := true; HorFin.Frame.DrawBottom := true; HorFin.Frame.DrawLeft := true; HorFin.Frame.DrawRight := true; HorFin.Transparent := true; HorFin.AutoSize := false; HorFin.Width := 43; HorFin.Font.Size := 10; HorFin.Font.Name := ´Arial´; HorFin.Font.Style := [fsBold]; // hora.Caption := inttostr(6+a)+´:00´; HorFin.Caption := ´´; HorFin.Alignment := tacenter; HorFin.top := 50+(HrF*25); HorFin.Parent := QrSemanal.QRBand1; end; //criacao do QrLabel do Instrutor begin Inst := TQRLabel.Create(Self); Inst.Name := ´Ins´; Inst.Left := 104; Inst.top := 480; Inst.Frame.DrawTop := true; Inst.Frame.DrawBottom := true; Inst.Frame.DrawLeft := true; Inst.Frame.DrawRight := true; Inst.Transparent := true; Inst.AutoSize := false; Inst.Width := 300; Inst.Font.Size := 12; Inst.Font.Name := ´Arial´; Inst.Parent := QrSemanal.QRBand1; end; soma := 0; for b:=1 to 16 do // total de aluno um em baixo do outro for c := 1 to 7 do // total de coluna de aluno begin soma := Soma + 1; aluno := TQRLabel.Create(Self); aluno.Name := ´Al´+inttostr(soma); aluno.Left := -40+(c*135); aluno.top := 50+(b*25); aluno.Frame.DrawTop := true; aluno.Frame.DrawBottom := true; aluno.Frame.DrawLeft := true; aluno.Frame.DrawRight := true; aluno.Transparent := true; aluno.AutoSize := false; aluno.Width := 130; aluno.Font.Size := 9; Aluno.Height := 22; aluno.Font.Name := ´Arial´; Aluno.Font.Style := [fsBold]; aluno.Caption := ´´; aluno.Parent := QrSemanal.QRBand1; end; //mostrar o nome do instrutor With DtmIza.QryPraticas do begin close; sql.Clear; sql.add(´Select Codigo, Nome from Instrutores where codigo =´+ TxtInst.Text); open; end; If not DtmIza.QryPraticas.IsEmpty then begin TQRLabel(FindComponent( ´Ins´ )).Caption := DtmIza.QryPraticas.FieldByName(´Nome´).AsString; end; // pesquisa de Horarios with dtmiza.QryIza do begin close; sql.clear; sql.add (´Select HorarioInicial, HorarioFinal, Instrutor from HorariosPraticas where Instrutor =:Ins´); ParamByName(´Ins´).AsString := TxtInst.Text; open; end; Cont := 1; while not dtmiza.QryIza.Eof do begin TQRLabel(FindComponent( ´Hor´ + IntToStr(Cont))).Caption := FormatDateTime(´hh:nn´, dtmiza.QryIza.FieldByName(´HorarioInicial´).AsDateTime); TQRLabel(FindComponent( ´HorFin´ + IntToStr(Cont))).Caption := FormatDateTime(´hh:nn´, dtmiza.QryIza.FieldByName(´HorarioFinal´).AsDateTime); DtmIza.QryIza.Next; Cont := Cont + 1; end; // pesquisa de alunos for x:=1 to 16 do begin for y:=1 to 7 do begin z:=z+1; if TQRLabel(FindComponent( ´Hor´ + IntToStr(x))).Caption <>´´ then begin DtmIza.QryPraticas.close; DtmIza.QryPraticas.sql.Clear; DtmIza.QryPraticas.sql.Add(´select p.instrutor, p.horario, p.data, p.aluno, p.bloqueado, a.codigo, a.nome from praticas p, alunos a´ +´ where instrutor =:inst and horario =:hor and data =:dat and p.aluno = a.codigo´); DtmIza.QryPraticas.ParamByName(´Inst´).AsString := TxtInst.Text; DtmIza.QryPraticas.ParamByName(´dat´).AsDate := StrtoDate(TQRLabel(FindComponent(´Dat´ + IntToStr( y ) ) ).Caption); DtmIza.QryPraticas.ParamByName(´hor´).AsTime := StrToTime(TQRLabel(FindComponent( ´Hor´ + IntToStr(x))).Caption); DtmIza.QryPraticas.open; end; if not DtmIza.QryPraticas.IsEmpty then begin if DtmIza.QryPraticas.FieldByName(´Bloqueado´).AsString = ´S´ then begin TQRLabel(FindComponent( ´Al´ + IntToStr(z))).Caption:= ´ **********************´; end; //else // begin TQRLabel(FindComponent( ´Al´ + IntToStr(z))).Caption := ´ ´ + DtmIza.QryPraticas.FieldByName(´nome´).asstring; // end; end; end; end; QrSemanal.Preview; QrSemanal.Free; DtmIza.QryPraticas.close; close; end;
Robinhocne
Curtidas 0
Respostas
Wdrocha
11/08/2008
Vc tah usando skin??
GOSTEI 0
Robinhocne
11/08/2008
não, no relatório eu desabilito
GOSTEI 0
Wdrocha
11/08/2008
Bom dia....conversando com um colega meu sobre o seu problema....
ele me disse q já teve o mesmo problema q o seu....
e q leu em um fórum q....
qdo uma aplicação tem mts Reports ela dá pau pq o QReport não é mais nativo do Delphi 7 e q ensinaram a ele usar o mínimo de QReports possível e no Menu Projects ----> Options -----> Auto Create Forms, carregá-los em memória junto com o Form Principal....
E disse q não teve mais problemas com os mesmos.....
Fica aew a dica....não testei....
Talvez seja o seu caso.....
Espero ter ajudado....
caso não resolva, posta aew....
Flw
ele me disse q já teve o mesmo problema q o seu....
e q leu em um fórum q....
qdo uma aplicação tem mts Reports ela dá pau pq o QReport não é mais nativo do Delphi 7 e q ensinaram a ele usar o mínimo de QReports possível e no Menu Projects ----> Options -----> Auto Create Forms, carregá-los em memória junto com o Form Principal....
E disse q não teve mais problemas com os mesmos.....
Fica aew a dica....não testei....
Talvez seja o seu caso.....
Espero ter ajudado....
caso não resolva, posta aew....
Flw
GOSTEI 0