Ver Mensaje Individual
  #14  
Antiguo 31-10-2008
lKinGl lKinGl is offline
Miembro
 
Registrado: ago 2007
Posts: 333
Reputación: 17
lKinGl Va por buen camino
he desarrollado este nuevo codigo ahora con campo único, funciona bien hasta aqui, pero necesito meterle un locate para que verifique antes si el registro esta no se agrega de lo contrario se registra, peroooo al momento de colocar el locate lanza un error no se porque :S

aqui envio mi codigo para ver que se puede hacer


Código Delphi [-]
procedure TForm44.BitBtn1Click(Sender: TObject);
var
Fecha:TDate;
unico,Grupo,Des,mes,ano:String;
debeouble;
begin

With Form1.Table11 do
  begin
    First;
    while not Eof do
      begin
        unico:=FieldValues['unico'];
        if  unico='0' then
          begin
          end
          else
          begin
            With form1.Table14 do
              Begin
                Insert;
                FieldValues['Fecha']:=form1.Table11.FieldValues['Fecha'];
                FieldValues['Grupo']:=Form1.Table11.FieldValues['Grupo'];
                FieldValues['Des_cu']:=Form1.Table11.FieldValues['des_cu'];
                FieldValues['debe']:=Form1.Table11.FieldValues['debe'];
                Post;
              end;
          end;
        Next;
      end;
  end;

if ComboBox1.Text='Seleccione Mes' then
  begin
    Application.MessageBox('Disculpe, debe seleccionar un Mes','');
    exit;
  end;

if ComboBox2.Text='Seleccione Año' then
  begin
    Application.MessageBox('Disculpe, debe seleccionar un Año','');
    exit;
  end;

mes:=IntToStr(ComboBox1.ItemIndex+1);
ano:=ComboBox2.Text;
edit1.Text:='01'+'/'+mes+'/'+ano;

with Form45.Query1 do begin
   Close;
   SQL.Text := 'Select Fecha,grupo,des_cu,debe,haber '+
             'from costosygastos.db '+
             'where Extract(month from fecha) = '+IntToStr(MonthOf(StrToDate(Edit1.Text)))+
             ' and Extract(year from fecha) = '+IntToStr(YearOf(StrToDate(Edit1.Text)));
   Open;
end;
form45.QRLabel1.Caption:='Costos y Gastos de '+ComboBox1.Text+' de '+ComboBox2.Text;
form45.QuickRep1.Preview;
exit;
end;

Gracias Adelantadas
__________________
Las cosas o son, o no son...
Responder Con Cita