FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC Seek a record
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Seek a record
Posted: Fri May 08, 2009 05:07 PM



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 (fw): Select all Collapse
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
Posts: 244
Joined: Fri Oct 28, 2005 06:29 PM
Re: Seek a record
Posted: Fri May 08, 2009 07:39 PM
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
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: Seek a record
Posted: Fri May 08, 2009 10:15 PM

thanks
now run but then not refresh the listbox

Best Regards, Saludos



Falconi Silvio

Continue the discussion