Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
When Close Tables Doesn't
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01031910
Message ID:
01031917
Views:
15
Hi Tracy,

1) Do you possibly have an open, uncommitted transaction in your main process code/other apps?
2) Have the values of dDir or scDir possibly changed between the open and the close/reopen?
3) Are you CERTAIN you're in the same data session when you return from the two other apps?
4) Could you design code into your OpenFile() method that makes use of the USED() function to check for an already open file? (I know, I know -- this treats the symptom, not the root cause)
5) Is there a SELECT statement that chooses data from the POLICY_D table into a cursor that's still active? (VFP may have USE'd AGAIN in one of the other apps if so, and then you might not be able get an EXCLUSIVE open)(long shot, I know)

Just some ideas for thought...

Evan

>I have a small executable that is a conversion utility. It calls two other apps. In most cases tables are opened, a process is run, and then tables are closed using CLOSE TABLES in VFP9. For some reason, I have stepped through this and closing tables doesn't. The below code is in the same prg except that openfiles function is in the main calling program of the primary app. Code:
>
>
>=OpenFile(ddir,'POLICY_D','MASTER',.T.,'SYSNUM')
>=OpenFile(scdir,'POLICY_D','SCMAST',.F.,'SYSNUM')
>=OpenFile(ddir,'POLICY_H')
>
>*--Process runs here
>
>CLOSE TABLES && appears to close all tables in the default data session but not alias 'MASTER'
>
>*--the first openfile line below fails because master is still open from above - close tables
>*--did not close it for some reason?  I have stepped through this and each line is processed
>*--but master remains open and the data session is still the default data session
>*--_vfp.autoyield should have any effect here
>
>=OpenFile(ddir,'POLICY_D','MASTER',.F.,'SYSNUM') && master is in still use for some reason?
>=OpenFile(scdir,'POLICY_D','SCMAST',.F.,'SYSNUM')
>
>*--Another process runs here
>
>CLOSE TABLES
>RETURN
>
>*--------------------------------------------------
>FUNCTION OpenFile
>PARAMETERS sDir, sFile, sAlias, bZap, sOrder
>
>IF EMPTY(sAlias)
>   sAlias = sFile
>ENDIF
>
>llFailed = .F.
>
>TRY
>
>   SELECT 0
>   USE (sDir+sFile) EXCLU ALIAS (sAlias)
>
>CATCH TO ErrObj
>
>   MsgText = "Error "+TRANSFORM(ErrObj.ERRORNO)+": "+;
>      ErrObj.MESSAGE +;
>      CHR(13)+CHR(13)+;
>      IIF(ErrObj.ERRORNO = 1705,'Could not open the file:'+CHR(13)+;
>      sDir+sFile+CHR(13)+'excusively.'+CHR(13)+CHR(13),;
>      'Could not open the file:'+CHR(13)+;
>      sDir+sFile+CHR(13)+CHR(13))
>   MESSAGEBOX(MsgText, 0+16+4096,'Error')
>   llFailed = .T.
>
>ENDTRY
>
>IF !llFailed
>   IF !EMPTY(sOrder)
>      SET ORDER TO TAG (sOrder)
>   ENDIF
>
>   ON ERROR DO sysErrMess IN MAIN WITH ;
>      ERROR(), MESSAGE(), MESSAGE( 1), PROGRAM(), LINENO()
>
>   IF bZap
>      ZAP
>   ENDIF
>
>   RETURN
>ELSE
>
>   ON ERROR DO sysErrMess IN MAIN WITH ;
>      ERROR(), MESSAGE(), MESSAGE( 1), PROGRAM(), LINENO()
>
>   StopLoop = .T.
>
>ENDIF
>
>RETURN
>
Evan Pauley, MCP
Positronic Technology Systems LLC
Knoxville, TN

If a vegetarian eats vegetables, what does a humanitarian eat?
Previous
Reply
Map
View

Click here to load this message in the networking platform