Seek a record

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Seek a record

Post 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


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 ?
Best Regards, Saludos

Falconi Silvio
User avatar
TecniSoftware
Posts: 213
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

Re: Seek a record

Post 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!
Alejandro Cebolido
Buenos Aires, Argentina
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Re: Seek a record

Post by Silvio »

thanks
now run but then not refresh the listbox
Best Regards, Saludos

Falconi Silvio
Post Reply