안뇽하신가여 고수님들 ㅠㅠ 
사발이가 오늘도 모르는게 있어서 질문을 함당...ㅠㅠ
아래의 소슨 제가 하고 있는 프로그램의 프린터 부분임당..ㅠㅠ 
이 프로시져의 쿼리부분을 돌리고 나서 프로그램을 종료하면 곧바로 에러 메시지가 나오네여 에러내용은 ㅠㅠ  만든회사에 문의하란말밖엔 안나옴당..ㅠㅠ 에러의 원인이 먼쥐는 찾았는디 왜 에러가 나는지는 모르겠네여 ㅠㅠ 머땜시 그럴까여? 
이유 아시는 고수님들 속시원하게 답글좀 달아주십시오 ㅠㅠ 
진짜이넘땜시 환장 x 2 임당 ㅠㅠ 
그럼 추운날 감기조심 하이소 ㅠㅠ
procedure Tgmmain_f.printer1;
var
 i,j,k,x:integer;
 page:integer;
begin
 
  for page:=1 to 2 do
   begin
    with gmdb.DataModule1.query1 do
     begin
      close;
      sql.Clear;
      sql.add('select distinct b.품명,b.단위,a.구매량,a.사용예정일,');
      sql.add('c.class,a.계정코드,a.구입사유');
      sql.add('from (gmmaster a inner join 구매품명 b on a.부품번호 = b.item),구매예산 c');
      sql.add('where  a.사번 = '''+sa+''' and a.작성일=:now1 and 청구번호='''+edit1.text+''' and a.계정코드=c.계정코드');
      parambyname('now1').asdatetime:=strtodatetime(formatdatetime('yyyy-mm-dd',datetimepicker1.Date));
      prepare;
      open;
    setmapmode(printer.Handle,mm_lometric);
    printer.Canvas.Font.Name := '굴림체';
    pr(printer.Canvas);
    with printer.Canvas do
     begin
       Font.Size := round(9*300/getdevicecaps(handle,logpixelsy));
       font.Style := [];
       textout(425,-288,edit1.Text);  // 청구no
       textout(1235,-288,formatdatetime('yyyy - mm - dd',now));  //작성일
       textout(450,-353,edit2.Text); //청구부서
       textout(985,-353,edit3.Text); //청구자
      if page=2 then
       begin
         Font.size := round(9*300/getdevicecaps(handle,LOGPIXELSY));
         font.style := [];
         textout(2630,-168,'(구매부서용)');
         textout(2005,-485,'구    입    사    유');
         textout(2430,-448,'1차  금액');
         textout(2640,-448,'2차  금액');
         textout(2412,-510,'수 량');
         textout(2412+105,-510,'확 인');
         textout(2622,-510,'수 량');
         textout(2622+105,-510,'확 인');
         pen.Width:=1;
         moveto(2405,-438);
         lineto(2405,-1572);
         moveto(2615,-438);
         lineto(2615,-1572);
         moveto(2405,-498);
         lineto(2819,-498);
         moveto(2510,-498);
         lineto(2510,-564);
         moveto(2720,-498);
         lineto(2720,-564);
           for k:=1 to 7 do
              begin
               for j:= 1 to 4 do
                 begin
                  moveto(2405,-498-k*126);
                  lineto(2819,-498-k*126);
                  moveto(2510,-498-k*126);
                  lineto(2510,-564-k*126);
                  moveto(2720,-498-k*126);
                  lineto(2720,-564-k*126);
               end;
            end;
         end
     else
        begin
             Font.Size := round(9*300/getdevicecaps(handle,logpixelsy));
             font.Style := [];
             textout(2121,-485,'구        입         사         유');
            textout(2630,-168,'(청구부서용)');
        end;
      x:=0;
        while not Eof do
         begin
           font.Size := round(8*300/getdevicecaps(printer.Handle,logpixelsy));
           font.Style := [];
           x:=x+1;
           textout(450,-488-126*x,fieldbyname('품명').AsString);
           textout(1225,-488-126*x,fieldbyname('단위').AsString);
           textout(1380,-488-126*x,fieldbyname('구매량').AsString);
           textout(1462,-488-126*x,fieldbyname('사용예정일').AsString);
           textout(1670,-448-126*x,fieldbyname('class').AsString);
           textout(1670,-510-126*x,copy(fieldbyname('계정코드').AsString,1,1));
           textout(1670+50,-510-126*x,copy(fieldbyname('계정코드').AsString,2,1));
           textout(1670+100,-510-126*x,copy(fieldbyname('계정코드').AsString,3,1));
           textout(1670+150,-510-126*x,copy(fieldbyname('계정코드').AsString,4,1));
           textout(1670+200,-510-126*x,copy(fieldbyname('계정코드').AsString,5,1));
           if page=1 then
           textout(2050,-488-126*x,fieldbyname('구입사유').AsString)
           else
           textout(2005,-488-126*x,fieldbyname('구입사유').AsString);
           next;
          if x = 7 then
           begin
           printer.NewPage;
            setmapmode(printer.Handle,mm_lometric);
             with printer.Canvas do
              begin
                pen.width := 2;
                rectangle(255,-438,2820,-1900);    // 외형
                pen.Width:=1;
                Font.size := round(9*300/getdevicecaps(handle,LOGPIXELSY));
                font.Style:=[];
                textout(425,-288,edit1.Text);  // 청구no
                textout(1235,-288,formatdatetime('yyyy - mm - dd',now));  //작성일
                textout(450,-353,edit2.Text); //청구부서
                textout(985,-353,edit3.Text); //청구자
                textout(255,-288,'청구NO :');
                textout(260,-353,'청구부서');
                textout(805,-353,'청 구 자');
                textout(1085,-288,'작성일 :');
                //청구부서
                rectangle(255,-338,765,-408);
                moveto(415,-338);
                lineto(415,-408);
                // 청구자
                rectangle(795,-338,1305,-408);
                moveto(955,-338);
                lineto(955,-408);
                   for i:= 1 to 9 do
                      begin
                         for k:=1 to 7 do
                           begin
                           for j:= 1 to 4 do
                             begin
                              textout(285,-488-k*126,formatfloat('00',k));
                              moveto(255,-438-i*126);
                              lineto(2819,-438-i*126);
                              moveto(1655,-498-k*126);
                              lineto(1905,-498-k*126);
                              moveto(1655+j*50,-498-k*126);
                              lineto(1655+j*50,-564-k*126);
                              if page=2 then
                               begin
                                      Font.size := round(9*300/getdevicecaps(handle,LOGPIXELSY));
                                      font.style := [];
                                      textout(2005,-485,'구    입    사    유');
                                      textout(2430,-448,'1차  금액');
                                      textout(2640,-448,'2차  금액');
                                      textout(2412,-510,'수 량');
                                      textout(2412+105,-510,'확 인');
                                      textout(2622,-510,'수 량');
                                      textout(2622+105,-510,'확 인');
                                      pen.Width:=1;
                                      moveto(2405,-438);
                                      lineto(2405,-1572);
                                      moveto(2615,-438);
                                      lineto(2615,-1572);
                                      moveto(2405,-498);
                                      lineto(2819,-498);
                                      moveto(2510,-498);
                                      lineto(2510,-564);
                                      moveto(2720,-498);
                                      lineto(2720,-564);
                                      moveto(2405,-498-k*126);
                                      lineto(2819,-498-k*126);
                                      moveto(2510,-498-k*126);
                                      lineto(2510,-564-k*126);
                                      moveto(2720,-498-k*126);
                                      lineto(2720,-564-k*126);
                                 end
                             else
                               begin
                                   Font.Size := round(9*300/getdevicecaps(handle,logpixelsy));
                                   font.Style := [];
                                   textout(2121,-485,'구        입         사         유');
                               end;
                        end;
                    end;
                 end;
                    // 세로줄
                     moveto(325,-1572);
                     lineto(325,-1900);
                     moveto(355,-438);
                     lineto(355,-1446);
                     moveto(1205,-438);
                     lineto(1205,-1572);
                     moveto(1305,-438);
                     lineto(1305,-1572);
                     moveto(1455,-438);
                     lineto(1455,-1572);
                     moveto(1655,-438);
                     lineto(1655,-1572);
                     moveto(1905,-438);
                     lineto(1905,-1572);
                     moveto(1455,-498);
                     lineto(1905,-498);
           //년월일
                     moveto(1522,-498);
                     lineto(1522,-564);
                     moveto(1589,-498);
                     lineto(1589,-564);
                     textout(261,-458,'일 련');
                     textout(261,-510,'번 호');
                     textout(455,-485,'품       명       및       규       격');
                     textout(1211,-485,'단 위');
                     textout(1335,-458,'불  출');
                     textout(1335,-510,'청구량');
                     textout(1472,-448,'사용예정일');
                     textout(1475,-510,'년');
                     textout(1542,-510,'월');
                     textout(1609,-510,'일');
                     textout(1682,-448,'차변계정과목');
                     textout(1745,-510,'CODE');
                     textout(492,-1493,'합');
                     textout(968,-1493,'계');
                     Font.size := round(8*300/getdevicecaps(handle,LOGPIXELSY));
                     font.style := [];
                     textout(275,-1632,'비');
                     textout(275,-1810,'고');
                     textout(345,-1592,'※예산반영 :');
                     font.Style := [fsbold];
                     textout(2580,-1910,'효성 컴퓨터 PU');
                end;
             x:=0;
            end;
        end;
       end;
     end;
      if page=1 then
     printer.NewPage;
   end;
 end;
			 
	
	
    
    
	
	
    
    
    
SetErrorMode(SEM_NOGPFAULTERRORBOX);
문장을 dpr파일에 넣어보세요.
억세스 바이올레이션에러등은 없어집니다.
사발우성 wrote:
> 안뇽하신가여 고수님들 ㅠㅠ
> 사발이가 오늘도 모르는게 있어서 질문을 함당...ㅠㅠ
> 아래의 소슨 제가 하고 있는 프로그램의 프린터 부분임당..ㅠㅠ
> 이 프로시져의 쿼리부분을 돌리고 나서 프로그램을 종료하면 곧바로 에러 메시지가 나오네여 에러내용은 ㅠㅠ 만든회사에 문의하란말밖엔 안나옴당..ㅠㅠ 에러의 원인이 먼쥐는 찾았는디 왜 에러가 나는지는 모르겠네여 ㅠㅠ 머땜시 그럴까여?
> 이유 아시는 고수님들 속시원하게 답글좀 달아주십시오 ㅠㅠ
> 진짜이넘땜시 환장 x 2 임당 ㅠㅠ
> 그럼 추운날 감기조심 하이소 ㅠㅠ
>
> procedure Tgmmain_f.printer1;
> var
> i,j,k,x:integer;
> page:integer;
> begin
>
>
> for page:=1 to 2 do
> begin
> with gmdb.DataModule1.query1 do
> begin
> close;
> sql.Clear;
> sql.add('select distinct b.품명,b.단위,a.구매량,a.사용예정일,');
> sql.add('c.class,a.계정코드,a.구입사유');
> sql.add('from (gmmaster a inner join 구매품명 b on a.부품번호 = b.item),구매예산 c');
> sql.add('where a.사번 = '''+sa+''' and a.작성일=:now1 and 청구번호='''+edit1.text+''' and a.계정코드=c.계정코드');
> parambyname('now1').asdatetime:=strtodatetime(formatdatetime('yyyy-mm-dd',datetimepicker1.Date));
> prepare;
> open;
>
> setmapmode(printer.Handle,mm_lometric);
> printer.Canvas.Font.Name := '굴림체';
> pr(printer.Canvas);
>
> with printer.Canvas do
> begin
> Font.Size := round(9*300/getdevicecaps(handle,logpixelsy));
> font.Style := [];
> textout(425,-288,edit1.Text); // 청구no
> textout(1235,-288,formatdatetime('yyyy - mm - dd',now)); //작성일
> textout(450,-353,edit2.Text); //청구부서
> textout(985,-353,edit3.Text); //청구자
>
> if page=2 then
> begin
> Font.size := round(9*300/getdevicecaps(handle,LOGPIXELSY));
> font.style := [];
> textout(2630,-168,'(구매부서용)');
> textout(2005,-485,'구 입 사 유');
> textout(2430,-448,'1차 금액');
> textout(2640,-448,'2차 금액');
> textout(2412,-510,'수 량');
> textout(2412+105,-510,'확 인');
> textout(2622,-510,'수 량');
> textout(2622+105,-510,'확 인');
> pen.Width:=1;
> moveto(2405,-438);
> lineto(2405,-1572);
> moveto(2615,-438);
> lineto(2615,-1572);
> moveto(2405,-498);
> lineto(2819,-498);
> moveto(2510,-498);
> lineto(2510,-564);
> moveto(2720,-498);
> lineto(2720,-564);
> for k:=1 to 7 do
> begin
> for j:= 1 to 4 do
> begin
> moveto(2405,-498-k*126);
> lineto(2819,-498-k*126);
> moveto(2510,-498-k*126);
> lineto(2510,-564-k*126);
> moveto(2720,-498-k*126);
> lineto(2720,-564-k*126);
> end;
> end;
> end
> else
> begin
> Font.Size := round(9*300/getdevicecaps(handle,logpixelsy));
> font.Style := [];
> textout(2121,-485,'구 입 사 유');
> textout(2630,-168,'(청구부서용)');
> end;
>
> x:=0;
>
> while not Eof do
> begin
> font.Size := round(8*300/getdevicecaps(printer.Handle,logpixelsy));
> font.Style := [];
> x:=x+1;
> textout(450,-488-126*x,fieldbyname('품명').AsString);
> textout(1225,-488-126*x,fieldbyname('단위').AsString);
> textout(1380,-488-126*x,fieldbyname('구매량').AsString);
> textout(1462,-488-126*x,fieldbyname('사용예정일').AsString);
> textout(1670,-448-126*x,fieldbyname('class').AsString);
> textout(1670,-510-126*x,copy(fieldbyname('계정코드').AsString,1,1));
> textout(1670+50,-510-126*x,copy(fieldbyname('계정코드').AsString,2,1));
> textout(1670+100,-510-126*x,copy(fieldbyname('계정코드').AsString,3,1));
> textout(1670+150,-510-126*x,copy(fieldbyname('계정코드').AsString,4,1));
> textout(1670+200,-510-126*x,copy(fieldbyname('계정코드').AsString,5,1));
> if page=1 then
> textout(2050,-488-126*x,fieldbyname('구입사유').AsString)
> else
> textout(2005,-488-126*x,fieldbyname('구입사유').AsString);
> next;
>
> if x = 7 then
> begin
> printer.NewPage;
> setmapmode(printer.Handle,mm_lometric);
> with printer.Canvas do
> begin
> pen.width := 2;
> rectangle(255,-438,2820,-1900); // 외형
> pen.Width:=1;
> Font.size := round(9*300/getdevicecaps(handle,LOGPIXELSY));
> font.Style:=[];
> textout(425,-288,edit1.Text); // 청구no
> textout(1235,-288,formatdatetime('yyyy - mm - dd',now)); //작성일
> textout(450,-353,edit2.Text); //청구부서
> textout(985,-353,edit3.Text); //청구자
> textout(255,-288,'청구NO :');
> textout(260,-353,'청구부서');
> textout(805,-353,'청 구 자');
> textout(1085,-288,'작성일 :');
> //청구부서
> rectangle(255,-338,765,-408);
> moveto(415,-338);
> lineto(415,-408);
> // 청구자
> rectangle(795,-338,1305,-408);
> moveto(955,-338);
> lineto(955,-408);
> for i:= 1 to 9 do
> begin
> for k:=1 to 7 do
> begin
> for j:= 1 to 4 do
> begin
> textout(285,-488-k*126,formatfloat('00',k));
> moveto(255,-438-i*126);
> lineto(2819,-438-i*126);
> moveto(1655,-498-k*126);
> lineto(1905,-498-k*126);
> moveto(1655+j*50,-498-k*126);
> lineto(1655+j*50,-564-k*126);
> if page=2 then
> begin
> Font.size := round(9*300/getdevicecaps(handle,LOGPIXELSY));
> font.style := [];
> textout(2005,-485,'구 입 사 유');
> textout(2430,-448,'1차 금액');
> textout(2640,-448,'2차 금액');
> textout(2412,-510,'수 량');
> textout(2412+105,-510,'확 인');
> textout(2622,-510,'수 량');
> textout(2622+105,-510,'확 인');
> pen.Width:=1;
> moveto(2405,-438);
> lineto(2405,-1572);
> moveto(2615,-438);
> lineto(2615,-1572);
> moveto(2405,-498);
> lineto(2819,-498);
> moveto(2510,-498);
> lineto(2510,-564);
> moveto(2720,-498);
> lineto(2720,-564);
> moveto(2405,-498-k*126);
> lineto(2819,-498-k*126);
> moveto(2510,-498-k*126);
> lineto(2510,-564-k*126);
> moveto(2720,-498-k*126);
> lineto(2720,-564-k*126);
> end
> else
> begin
> Font.Size := round(9*300/getdevicecaps(handle,logpixelsy));
> font.Style := [];
> textout(2121,-485,'구 입 사 유');
> end;
> end;
> end;
> end;
>
> // 세로줄
> moveto(325,-1572);
> lineto(325,-1900);
> moveto(355,-438);
> lineto(355,-1446);
> moveto(1205,-438);
> lineto(1205,-1572);
> moveto(1305,-438);
> lineto(1305,-1572);
> moveto(1455,-438);
> lineto(1455,-1572);
> moveto(1655,-438);
> lineto(1655,-1572);
> moveto(1905,-438);
> lineto(1905,-1572);
> moveto(1455,-498);
> lineto(1905,-498);
> //년월일
> moveto(1522,-498);
> lineto(1522,-564);
> moveto(1589,-498);
> lineto(1589,-564);
> textout(261,-458,'일 련');
> textout(261,-510,'번 호');
> textout(455,-485,'품 명 및 규 격');
> textout(1211,-485,'단 위');
> textout(1335,-458,'불 출');
> textout(1335,-510,'청구량');
> textout(1472,-448,'사용예정일');
> textout(1475,-510,'년');
> textout(1542,-510,'월');
> textout(1609,-510,'일');
> textout(1682,-448,'차변계정과목');
> textout(1745,-510,'CODE');
> textout(492,-1493,'합');
> textout(968,-1493,'계');
> Font.size := round(8*300/getdevicecaps(handle,LOGPIXELSY));
> font.style := [];
> textout(275,-1632,'비');
> textout(275,-1810,'고');
> textout(345,-1592,'※예산반영 :');
> font.Style := [fsbold];
> textout(2580,-1910,'효성 컴퓨터 PU');
>
> end;
> x:=0;
> end;
> end;
> end;
> end;
> if page=1 then
> printer.NewPage;
> end;
> end;
>