FoxPro/Visual FoxPro - duplicacion de registros

 
Vista:

duplicacion de registros

Publicado por Anabella (24 intervenciones) el 11/02/2015 16:12:05
Hola Gente!!! tengo un problema cuando cargo un registro nuevo en una tabla por medio de un formulario, me duplica el ultimo registro cargado.

El evento click() del botón NUEVO es:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
select perfumeria
set order to autor
 
go bottom
 
***limpiar los texbox
ThisForm.text1.Value = ""
ThisForm.text2.Value = ""
ThisForm.text3.Value = ""
ThisForm.text4.Value = ""
ThisForm.text5.Value = ""
ThisForm.text6.Value = ""
ThisForm.text7.Value = ""
ThisForm.text8.Value = ""
 
***habilitar los textbox  (dejar inhabilitados desde el proyecto "enabled=.f.")
ThisForm.text1.Enabled = .T.
ThisForm.text2.Enabled = .T.
ThisForm.text3.Enabled = .T.
ThisForm.text4.Enabled = .T.
ThisForm.text5.Enabled = .T.
ThisForm.text6.Enabled = .T.
ThisForm.text7.Enabled = .T.
ThisForm.text8.Enabled = .T.
 
*LE ASIGNO EL FOCO AL TEXT1
ThisForm.text1.SetFocus
 
*HABILITO LOS BOTONES DE GUARDAR Y CANCELAR Y DESHABILITO EL RESTO DE BOTONES
ThisForm.Command11.Enabled = .F. &&PRIMERO
ThisForm.Command2.Enabled = .F.  &&ANTERIOR
ThisForm.Command3.Enabled = .F.  &&SIGUIENTE
ThisForm.Command9.Enabled = .F.  &&ULTIMO
ThisForm.Command1.Enabled = .F.  &&NUEVO
ThisForm.Command5.Enabled = .T.  &&GUARDAR
ThisForm.Command6.Enabled = .F.  &&MODIFICAR
ThisForm.Command7.Enabled = .F.  &&LISTO
ThisForm.Command10.Enabled = .F. &&ELIMINAR
ThisForm.Command8.Enabled = .T.  &&CANCELAR
ThisForm.Command12.Enabled = .F. &&SALIR
 
THISFORM.Refresh


El evento click() del botón GUARDAR es:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
select perfumeria
append blank
REPLACE autor WITH ThisForm.text1.Value
REPLACE descripcion WITH ThisForm.text2.Value
REPLACE stock WITH ThisForm.text3.Value
REPLACE precioc WITH ThisForm.text4.Value
REPLACE ganancia WITH ThisForm.text5.Value
REPLACE preciov WITH ThisForm.text6.Value
REPLACE proveedor WITH ThisForm.text7.Value
REPLACE fechac WITH ThisForm.text8.Value
 
***inhabilitar los textbox
ThisForm.text1.Enabled = .f.
ThisForm.text2.Enabled = .f.
ThisForm.text3.Enabled = .f.
ThisForm.text4.Enabled = .f.
ThisForm.text5.Enabled = .f.
ThisForm.text6.Enabled = .f.
ThisForm.text7.Enabled = .f.
ThisForm.text8.Enabled = .f.
 
*DESHABILITO EL BOTON DE GUARDAR Y CANCELAR Y HABILITO EL RESTO DE BOTONES
ThisForm.Command11.Enabled = .T. &&PRIMERO
ThisForm.Command2.Enabled = .T.  &&ANTERIOR
ThisForm.Command3.Enabled = .T.  &&SIGUIENTE
ThisForm.Command9.Enabled = .T.  &&ULTIMO
ThisForm.Command1.Enabled = .T.  &&NUEVO
ThisForm.Command5.Enabled = .F.  &&GUARDAR
ThisForm.Command6.Enabled = .T.  &&MODIFICAR
ThisForm.Command7.Enabled = .T.  &&LISTO
ThisForm.Command10.Enabled = .T. &&ELIMINAR
ThisForm.Command8.Enabled = .F.  &&CANCELAR
ThisForm.Command12.Enabled = .T. &&SALIR
 
THISFORM.Refresh

¿Qué estoy haciendo mal ? ¿o no estoy haciendo?
Necesito su ayuda con urgencia!!!!!!!!!!!!!
Muchas gracias!!!!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

duplicacion de registros

Publicado por Anabella (24 intervenciones) el 11/02/2015 22:56:02
Gracias Mauricio!!!!
Si, si me sirvió, ahora me gustaría entender por que de esta forma anda y la forma que yo planteo no.
Muchas gracias por la ayuda!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

duplicacion de registros

Publicado por antonio patiño mendez (60 intervenciones) el 17/02/2015 16:51:25
TE RECOMIENDO USES LOS FORMULARIOS QUE EL MISMO VISUAL FOX TE OFRECE PARA GENERAR EN FORMA AUTOMATICA,,, SON MODIFICABLES PARA QUE LE AGREGUES TODAS LAS VALIDACIONES QUE QUIERAS.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

duplicacion de registros

Publicado por antonio patiño mendez (60 intervenciones) el 17/02/2015 16:57:57
ES PROBABLE QUE TENGAS UNA VALIDACION DE NO REPETIR ALTAS ,,, O TE FALTA ESA VALIDACION EN FORMA CORRECTA. ESO SE HACE DANDO DE ALTA DOS VECES LA TABLA EN EL FORMULARIO Y VALIDAS QUE NO EXISTA CONTRA LA LLAVE DE LA SEGUNDA TABLA DADA DE ALTA. (SON IGUALES LAS DOS TABLAS),,, LA SEGUNDA TABLA DADA DE ALTA SOLO SIRVE PARA VALIDAR NO EXISTA YA EL REGISTRO QUE QUIERAS DAR DE ALTA.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar