FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Search a date
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Search a date
Posted: Sun Sep 21, 2014 04:33 PM
I must valid a DTPICKER control and see if the date past is on archive

the archive have one index and it is on dtos(giorno) ( the field of archive is Giorno d 8 )

I made this function but it return me allways it not found the date

Code (fw): Select all Collapse
  
function Controlla_Giorno( dGiorno, oGet, nMode )
   // nMode    1 nuevo registro
   //          2 modificación de registro
   //          3 duplicación de registro
   //          4 clave ajena
   local lreturn  := .f.
   local nRecno   := CA->( RecNo() )
   local nOrder   := CA->( OrdNumber() )
   local nArea    := Select()

   if Empty( dGiorno )
      if nMode == 4
         return .t.
      else
         MsgStop("E' obbligatorio questo campo.")
         return .f.
      endif
   endif

   SELECT CA
   CA->( DbSetOrder( 1 ) )
   CA->( DbGoTop() )

   if CA->( DbSeek( dGiorno ) )
      nmsgBox("Found!")
      DO CASE
         Case nMode == 1 .OR. nMode == 3
            lreturn := .f.
            MsgStop("Data esistente.")
         Case nMode == 2
            if CA->( Recno() ) == nRecno
               lreturn := .t.
            else
               lreturn := .f.
               MsgStop("Data esistente.")
            endif
         Case nMode == 4
            lreturn := .t.
      END CASE
   else
      nmsgBox(" not found!")
      if nMode < 4
         lreturn := .t.
      else
         if MsgYesNo("Data inesistente. ¿ Desideri inserirlo ora? ")
           * lreturn := CLEdita( , 1, , , @dGiorno )
         else
            lreturn := .f.
         endif
      endif
   endif

   if lreturn == .f.
     * oGet:cText( space(50) )
   endif

   CA->( DbSetOrder( nOrder ) )
   CA->( DbGoTo( nRecno ) )

   Select (nArea)

return lreturn


I use this function when I must search a character field and it run but now with a date field I have problem beacause it not run How I wish
Any help please ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Search a date
Posted: Sun Sep 21, 2014 04:59 PM
Silvio.Falconi wrote:
Code (fw): Select all Collapse
if CA->( DbSeek( dGiorno ) )


Code (fw): Select all Collapse
if CA->( DbSeek( DToS( dGiorno ) ) )


EMG
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: Search a date
Posted: Sun Sep 21, 2014 05:05 PM

thanks.... Sorry enrico ... I have to sleep at night instead of going around looking for girls ...
happens that not even remember the basic programming!!!!

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion