Código Delphi
[-]
procedure TFalumnos.Button1Click(Sender: TObject);
var
vence:word;
inicio: tdate;
ruta:string;
begin
vence:= DaysInMonth(now);
if modificacion=false then
begin
fmodulo.talumnos.FieldByName('fecha_ingreso').AsDateTime:= now;
fmodulo.talumnos['fecha_inicio']:=self.DBinicio.Text;
end
else
begin
fmodulo.talumnos.Active:=true;
fmodulo.talumnos.Edit;
modificacion:=false;
end;
if self.dbapellidos.Text='' then
begin
Application.MessageBox('El campo Apellido no puede ser vacio','Gimnasio',MB_OK+MB_ICONWARNING);
self.dbapellidos.SetFocus;
end
else
if self.DBnombres.Text='' then
begin
Application.MessageBox('El campo Nombre no puede ser vacio','Gimnasio',MB_OK+MB_ICONWARNING);
self.DBnombres.SetFocus;
end
else
if self.DBinicio.Text='' then
begin
Application.MessageBox('El campo Fecha de inicio no puede ser vacio','Gimnasio',MB_OK+MB_ICONWARNING);
self.DBinicio.SetFocus;
end
else
if self.DBLookupComboBox1.KeyValue=null then
begin
Application.MessageBox('El campo tarifa no puede ser vacio','Gimnasio',MB_OK+MB_ICONWARNING);
self.DBLookupComboBox1.SetFocus;
end
else
if self.DBdni.Text='' then
begin
Application.MessageBox('El campo Dni no puede ser vacio','Gimnasio',MB_OK+MB_ICONWARNING);
self.DBdni.SetFocus;
end ;
begin
fmodulo.talumnos['fecha_vencimiento']:= fmodulo.talumnos['fecha_inicio'] + vence;
fmodulo.talumnos.FieldByName('foto').AsString:= OpenPictureDialog1.FileName;
fmodulo.talumnos.Post;
fmodulo.zqmodificacionestado.ExecSQL;
fmodulo.ZQlisalumnosfecha.Active:=true;
fmodulo.zqlisalumnosfecha.refresh;
fmodulo.talumnos.Refresh;
fmodulo.ZQlisalumnosfecha.Close;
fmodulo.talumnos.Close;
self.Close;
end;
este seria el codigo del boton aceptar.