La Web del Programador: Comunidad de Programadores
 
    Pregunta:  66372 - RUTINA DE SEEK VFP9.0
Autor:  Alejandro Chavarria Nuñez
¡Hola Programadores del mundo!
Les tengo una pequeña consulta con respecto a la rutina de el comando SEEK
al momento de que ejecuto un formulario me busque el registro indexado. si lo encuentra que me notifique , si no, que lo guarde. Al parecer me esta dando problemas ya que cuando le doy al botón guardar solo me salta la condición que diga que ya existe el registro , pero siempre lo guarda.
¿que estoy haciendo mal?. Aquí les dejo mi rutina :

SET ORDER TO num_cheque

SEEK (thisform.txtnum_cheque.value )
IF FOUND()
MESSAGEBOX("NUMERO DE CHEQUE YA INGRESADO EN LA BASE DE DATOS", 48, "ERROR")
ELSE
Reemplazar registro with thisformtxtbox.value . . .
ENDIF

Saludos desde Honduras.

  Respuesta:  Sebastian Penayo
lo que faltaria es que limpié todo el el text donde digitas el código del cheque. y lo retornes ahi.

SET ORDER TO num_cheque

SEEK (thisform.txtnum_cheque.value )
IF FOUND()
MESSAGEBOX("NUMERO DE CHEQUE YA INGRESADO EN LA BASE DE DATOS", 48, "ERROR")
thisform.txtnum_cheque.value=0 && caso que sea numérico
thisform.txtnum_cheque.value=space(30) && caso que sea alfanumérico
thisform.txtnum_cheque.enabled=.t. && habilitas el text
thisform.txtnum_cheque.setfocus() &&retorne el cursor en ese text
ELSE
Reemplazar registro with thisformtxtbox.value . . .
ENDIF