problemas al actualizar una tabla en modo buffer

josho
26 de Mayo del 2004
Hola Tengo El Siguiente Problema En Las Altas Y Bajas En Visualfox
Cuando Hago Una Baja (Estoy Trabjando En Modo Buffer) Al Hacer Una Baja No Me Actualiza Los Datos Al Borrar Con Tableupdate, Aparte No Me Sirve De Nada Por Que Hace Un Borrado Logico Y Yo Lo Que Quiero Es Eliminarlo Fisicamewnte Del Disco Por Que Al Agregar (Alta)Uno Si Bien No Me Lo Muestra Esta Fisicamente al eliminarlo se encuentra en disco, Y Ocasiona Problemas, Estoy Trabajando Con Bases De Datos No Tablas Libres Y A Los Campos Clave No Se Pueden Repetir Y Sale Un Error Se Infringe La Unbicidad Y Se Planta

A La Baja Lo Solucione Colocando Un Pack Debajo De La Funcion Tableupdate, Pero Lo Comico Es Que Aveces No Funiona Y Aveces Funciona De Diez O En Algunos Formularios De Carga Funcionan Bien Y En Otros sale El error, El Cual Es Logico Que No Se Puede Ejecutar El Comando Pack O Algo Asi Por Que Se Esta Trabajando En Modo Buffer..
Mi Preguntab Es Como Puedo Solucionar Esto?.

Otra Es Cuando Realizo La Baja Con El Pack Ya Fucnoinando Me Sale Un Error Que Se Por Que esta En Otra Area De Trabajo. Puede Ser Por Que El Pack Al Borrar Copia La Tabla Originalcon Los Registros No Marcados En Una Tabla Temporal Y Luego Elimina La Tabla Original Y Depues La Reemplaza Por La Original A La Temporal. Si Es Asi Como Lo Soluciono.
Yo Probe Tratando De Colocar Al Seleccionar La Tabla En Ves De Select "Nombre Tabla" Usando Use "Nombre Tabla" In 0 Pero Sale Error No Se Puede Encontar La Tabla.Dbf


El codigo es el siguiente:


alta:

ELECT 0
select instituciones
if thisform.command1.caption ="NUEVO" then
THISFORM.txtid_inst.enabled = .t.
thisform.txtid_inst.setfocus && asigan el foco al txtdni
THISFORM.txtnombre.enabled = .t.
THISFORM.txtNro.enabled = .t.
THISFORM.combo2.enabled = .t.
THISFORM.combo1.enabled = .t.
THISFORM.combo3.enabled = .t.
THISFORM.combo4.enabled = .t.
THISFORM.combo5.enabled = .t.
THISFORM.combo6.enabled = .t.
THISFORM.combo7.enabled = .t.
THISFORM.txtDireccion.enabled = .t.
THISFORM.combo8.enabled = .t.
THISFORM.combo9.enabled = .t.
THISFORM.combo10.enabled = .t.
THISFORM.txtTel.enabled = .t.
THISFORM.txtCant_b_adu2.enabled = .t.
THISFORM.txtCant_b_os.enabled = .t.
THISFORM.txtCant_b_as.enabled = .t.
THISFORM.txtCant_aulas2.enabled = .t.
*****************************************
thisform.command2.enabled = .f.
thisform.command3.enabled = .f.
append blank
thisform.refresh
thisform.command1.caption = "Grabar"

else
a= messagebox("estas seguro",4+32+256)
if a =6
if thisform.txtid_inst.value =0 or thisform.txtid_inst.value = NULL
=tablerevert()
messagebox("no puede estar vacio")
else
=tableupdate()
endif
else
=tablerevert()
endif
thisform.refresh
THISFORM.txtid_inst.enabled = .f.
THISFORM.txtnombre.enabled = .f.
THISFORM.txtNro.enabled = .f.
THISFORM.combo2.enabled = .f.
THISFORM.combo1.enabled = .f.
THISFORM.combo3.enabled = .f.
THISFORM.combo4.enabled = .f.
THISFORM.combo5.enabled = .f.
THISFORM.txtDireccion.enabled = .f.
THISFORM.combo6.enabled = .f.
THISFORM.combo7.enabled = .f.
THISFORM.combo8.enabled = .f.
THISFORM.combo9.enabled = .f.
THISFORM.combo10.enabled =.f.
THISFORM.txtTel.enabled = .f.
THISFORM.txtCant_b_adu2.enabled = .f.
THISFORM.txtCant_b_os.enabled = .f.
THISFORM.txtCant_b_as.enabled = .f.
THISFORM.txtCant_aulas2.enabled = .f.
* esto te perdmite dejar habilitado los botones si no haces click en nuevo
thisform.command2.enabled = .t.
thisform.command3.enabled = .t.
thisform.command1.caption = "NUEVO"

endif

thisform.refresh



baja:
=======


SELECT 0 && aquí trate en ves de usar select 0 y luego select instituciones usar use instituciones in 0 pero no funcoina por que? select instituciones
cant_reg=reccount()
thisform.refresh
if thisform.command2.caption ="Baja"
thisform.command1.enabled = .f.
thisform.command3.enabled = .f.
if cant_reg = 0
messagebox("no existe ningun registro en la tabla")
thisform.command2.caption="Baja"
thisform.command1.enabled = .t.
thisform.command3.enabled = .t.
else
set delete on
delete
thisform.command2.caption="Eliminar"
thisform.refresh
endif
else
thisform.refresh
a= messagebox("estas seguro",4+32+256)
if a=6
=tableupdate()
pack
thisform.refresh
else
=tablerevert()
thisform.refresh
endif
thisform.refresh
thisform.command2.caption ="Baja"
thisform.command1.enabled = .t.
thisform.command3.enabled = .t.
endif
thisform.refresh



modificacion:
===============


SELECT 0
select instituciones

if thisform.command3.caption ="Modificar" then

cant_reg=reccount()
if cant_reg = 0
messagebox("no existe ningun registro en la tabla")
thisform.command3.caption="Modificar"
thisform.command1.enabled = .t.
thisform.command2.enabled = .t.
else
thisform.command1.enabled = .f.
thisform.command2.enabled = .f.

THISFORM.txtid_inst.enabled = .t.
THISFORM.txtnombre.enabled = .t.
THISFORM.txtNro.enabled = .t.
THISFORM.combo1.enabled = .t.
THISFORM.combo2.enabled = .t.
THISFORM.combo3.enabled = .t.
THISFORM.combo4.enabled = .t.
THISFORM.txtDireccion.enabled = .t.
THISFORM.combo5.enabled = .t.
THISFORM.combo6.enabled = .t.
THISFORM.combo7.enabled = .t.
THISFORM.combo8.enabled = .t.
THISFORM.combo9.enabled = .t.
THISFORM.combo10.enabled = .t.
THISFORM.txtTel.enabled = .t.
THISFORM.txtCant_b_adu2.enabled = .t.
THISFORM.txtCant_b_os.enabled = .t.
THISFORM.txtCant_b_as.enabled = .t.
THISFORM.txtCant_aulas2.enabled = .t.
thisform.command3.caption = "Grabar"
thisform.refresh
endif


else
a=messagebox("estas seguro",4+32+256)
if a=6
=tableupdate()
else
=tablerevert()
endif

THISFORM.txtid_inst.enabled = .f.
THISFORM.txtnombre.enabled = .f.
THISFORM.txtNro.enabled = .f.
THISFORM.combo1.enabled = .f.
THISFORM.combo2.enabled = .f.
THISFORM.combo3.enabled = .f.
THISFORM.combo4.enabled = .f.
THISFORM.combo5.enabled = .f.
THISFORM.combo6.enabled = .f.
THISFORM.combo7.enabled = .f.
THISFORM.combo8.enabled = .f.
THISFORM.txtDireccion.enabled = .f.
THISFORM.combo9.enabled = .f.
THISFORM.combo10.enabled = .f.

THISFORM.txtTel.enabled = .f.
THISFORM.txtCant_b_adu2.enabled = .f.
THISFORM.txtCant_b_os.enabled = .f.
THISFORM.txtCant_b_as.enabled = .f.
THISFORM.txtCant_aulas2.enabled = .f.
thisform.command1.enabled = .t.
thisform.command2.enabled = .t.
thisform.command3.caption = "Modificar"

endif

thisform.refresh