Several comments on your issue.
Zap only works if the DBF is only used in exclusive mode that should be
set bij SetExclusive(TRUE). It should not be open in other parts of your
app. I think the DBF was open in parts of your app that you are not
aware of and therefore you cannot zap it.
You can use this code to see what DBF's are open
cMsg := ''
FOR wAlias := 1 UPTO 1024
cAlias := ALIAS(wAlias)
IF .NOT. ( cAlias == NULL_STRING )
dwMethresult += 1
cMsg += NTrim(wAlias)+' workarea<.>'
cMsg += '<9>Alias<9><9>'+cAlias+'<.>'
cMsg += '<9>File name<9><9>'+ (cAlias)->(DBINFO(DBI_FULLPATH))+'<.>'
cMsg += '<9>Locked records<9>'+
Put the code in a funtion that you call when debugging your app to see
what DBF's are open en check wether these are the ones that you expect
to be open.
I'm sure that somewhere you did not close a DBF and thyerefore you
cannot ZAP it
I'm having a DBF where lots of changes take place. To prvent the DBF
growing by adding records and deleting them without being able to ZAP
it. I'm using special delete and apend methods of the DBF
METHOD DeleteToReuse() CLASS MySpecialDbf
lResult := SUPER:Delete()
SELF:Filed1 := ""
SELF:Field2 := ""
METHOD AppendReuse() CLASS MySpecialDbf
LOCAL lMethResult AS LOGIC
LOCAL lDeleted AS LOGIC
LOCAL dwRecNr := 0 AS DWORD
lDeleted := SetDeleted()
CASE ! SELF:Seek(Space(10)) // Seek on first empty field that can
only be empty when deleted
CASE ! SELF:Recall()
* Message that deleted record cannot be recalled
dwRecNr := SELF:RecNo
lMethResult := TRUE
IF dwRecNr = 0
* no old record found that could be recalled
lMethResult := SUPER:Append()
* empty record recalled
In this way your DBF will not be for ever growing and there is no need
to have a EXCLUSIVE access to the DBF
CollectForced() is normaly not needed unless you do not clean all memory
by ending resources.
When debugging I put this in my shellwindow
METHOD Timer() CLASS MyShellWindow
If the memory keeps on growing then you hev and issue with nog ending
windows of window parameters neatly.
I you close it down in the right way there is no need to use Destroy()
Hope this can help you
Op 15-6-2021 om 21:06 schreef aurora baccio: