Page 1 of 1

Seek a record

PostPosted: Fri May 08, 2009 5:07 pm
by Silvio
Image


On main program I open the file dbf

USE ( CurDir() + "\Clientes" ) VIA "DBFCDX"
if RecCount() == 0
APPEND BLANK
endif
if ! File( CurDir() + "\CliName.CDX" )
INDEX ON Clientes->Nombre TO ( CurDir() + "\CliName" )
endif
Clientes->( OrdSetFocus( "CliName" ) )
Clientes->( DbGoTop() )

and then on seek function
Code: Select all  Expand view


static function SeekClient( oLbx )

  local cNombre := Space( 30 )
  local nRecNo  := clientes->(RecNo())

  SET SOFTSEEK ON

   Clientes->( OrdSetFocus( "CliName" ) )


   if MsgGet( "Search", "Customer Name", @cNombre,;
              "lupa.bmp" )

      if !  clientes->( DbSeek(  cNombre, .t. ) )
         MsgAlert( "I don't find that customer" )
         GO nRecNo
      else
         oLbx:UpStable()           // Corrects same page stabilizing Bug
         oLbx:Refresh()            // Repaint the ListBox
      endif
   endif

return nil



where I make error ?

Re: Seek a record

PostPosted: Fri May 08, 2009 7:39 pm
by TecniSoftware
Silvio:

Evidentemente no está abriendo el índice.

Prueba con:

if !File( CurDir() + "\CliName.CDX" )
INDEX ON Clientes->Nombre TO ( CurDir() + "\CliName" )
endif

Clientes->(DbSetIndex( CurDir() + "\CliName" ))

Clientes->( OrdSetFocus( "CliName" ) )
Clientes->( DbGoTop() )

Saludos!

Re: Seek a record

PostPosted: Fri May 08, 2009 10:15 pm
by Silvio
thanks
now run but then not refresh the listbox