I have this error
- Code: Select all Expand view
Application
===========
Path and name: C:\work\PRG\agenda2\Agenda2.Exe (32 bits)
Size: 2,383,360 bytes
Time from start: 0 hours 0 mins 11 secs
Error occurred at: 08-02-2011, 20:50:49
Error description: Error DBCMD/2001 Workarea not in use: ORDSETFOCUS
Stack Calls
===========
Called from: => ORDSETFOCUS(0)
Called from: source\gut120.prg => ADDDATES(344)
Called from: source\gut120.prg => (b)BUILDCALEX(186)
Called from: .\source\prg\tcalex.PRG => TCALEX:SETVIEW(1279)
Called from: .\source\prg\tcalex.PRG => (b)TCALEX:TCALEX(153)
Called from: => TCALEX:SETMONTHVIEW(0)
Called from: source\gut120.prg => BUILDCALEX(186)
Called from: source\gut120.prg => (b)GUT120(97)
Called from: .\source\classes\DIALOG.PRG => TFSDI:INITIATE(720)
Called from: .\source\classes\DIALOG.PRG => TFSDI:HANDLEEVENT(928)
Called from: => CREATEDLGINDIRECT(0)
Called from: .\source\classes\DIALOG.PRG => TFSDI:ACTIVATE(302)
Called from: source\gut120.prg => GUT120(97)
Called from: source\MainLib.prg => (b)PERFORM(451)
Called from: source\MainLib.prg => PERFORM(452)
Called from: source\main.prg => (b)TAPPLICATION:BUILDBTNBAR(518)
Called from: .\source\classes\TRBTN.PRG => TRBTN:CLICK(579)
Called from: .\source\classes\TRBTN.PRG => TRBTN:LBUTTONUP(754)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1489)
Called from: .\source\classes\TRBTN.PRG => TRBTN:HANDLEEVENT(1398)
Called from: .\source\classes\WINDOW.PRG => _FWH(3394)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(978)
Called from: source\main.prg => TAPPLICATION:ACTIVATE(426)
Called from: source\main.prg => MAIN(63)
I explain you
I open first the dbf with
oDCal:=Apri_dbf("citas",.t.,.t.)
(oDCal)->(OrdSetFocus(1))
(oDCal)->(DbGoTop())
...
AddDates(........)
this function Apri_dbf
- Code: Select all Expand view
FUNCTION Apri_Dbf( cDbf, lNew, lIdx, aIdx, nIdxa )
LOCAL cFile, cABas, lErr := .F.
LOCAL cDriver := DBSetDriver()
LOCAL nD, cAlias
DEFAULT lNew := .T.
DEFAULT lIdx := .F.
DEFAULT nIdxa := .T.
DEFAULT aIdx := NIL
cDbf := Upper( cDbf )
IF Empty( aDbfs )
aDbfs := { }
ENDIF
IF Select( cDbf ) > 0
DBSelectArea( cDbf )
IF lNew
nD := AScan( aDbfs, { | aAt | aAt[ 1 ] == cDbf } )
IF nD > 0
aDbfs[ nD, 2 ] ++
ENDIF
cAlias := New_Alias( cDbf, nD )
DBUseArea( .T., cDriver, cDbf, cAlias, .T., .F. )
IF File( cDbf + ".cdx" ) .and. nIdxa
( cAlias ) ->( DBSetIndex( cDbf ) )
( cDbf ) ->( DBSetOrder( 1 ) )
ENDIF
ENDIF
ELSE
IF ! File( cDbf + ".dbf" )
MSGINFO("NON EXISTE IL DATAFILE") //Non esiste il database
lErr := .T.
ELSE
nD := AScan( aDbfs, { | aAt | aAt[ 1 ] == cDbf } )
IF nD = 0
AAdd( aDbfs, { cDbf, 1 } )
nD := AScan( aDbfs, { | aAt | aAt[ 1 ] == cDbf } )
ELSE
aDbfs[ nD, 2 ] ++
ENDIF
cAlias := New_Alias( cDbf, nD )
DBUseArea( .T., cDriver, cDbf, cAlias, .T., .F. )
IF File( cDbf + ".CDX" ) .and. nIdxa
( cAlias ) ->( DBSetIndex( cDbf ) )
( cAlias ) ->( DBSetOrder( 1 ) )
ENDIF
ENDIF
ENDIF
IF ! lErr .AND. lIdx
cFile := Upper( cDbf )
cABas := Apri_Dbf( "BASE" )
( cABas ) ->( DBSeek( cFile ) )
IF Found()
DO WHILE ( cABas ) ->TABELLA = cFile .AND. ! ( cABas ) ->( Eof() )
AAdd( aIdx, ( cABas ) ->Commento )
//AAdd(aIdx,(cABas)->Legend)
( cABas ) ->( DBSkip() )
ENDDO
ENDIF
Chiudi_Dbf( "BASE", cABas )
DBSelectArea( cDbf )
ENDIF
RETURN ( cAlias )
and this function make error
- Code: Select all Expand view
FUNCTION AddDates( dStart, dEnd, nStart, nEnd,oDCal )
local dDate
// compat with xharbour
DEFAULT dStart := CToD(" / / ")
DEFAULT dEnd := CToD(" / / ")
//Clear scopes
(oDCal)->( OrdSetFocus(1))
(oDCal)->(OrdScope(TOPSCOPE,Nil))
(oDCal)->(OrdScope(BOTTOMSCOPE,Nil))
//Set New scopes
(oDCal)->(DBGoTop())
(oDCal)->(OrdScope(TOPSCOPE, DToS( dStart ) + Str( nStart * 100, 4 ) ) )
(oDCal)->(OrdScope(BOTTOMSCOPE, DToS( dEnd ) + Str( nEnd * 100, 4 ) ) )
(oDCal)->(DBGoTop())
oApp():oCalex:Reset()
DO WHILE ! ( oDCal )->( Eof() )
oApp():oCalex:LoadDates( ( oDCal )->START,;
( oDCal )->END, ;
( oDCal )->DSTART, ;
( oDCal )->DEND, ;
( oDCal )->TEXT, ;
( oDCal )->SUBJECT,;
( oDCal )->IDX )
( oDCal )->( DBSkip() )
ENDDO
RETURN nil
where is the error ?