Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check for Exclusive Open?
Message
From
14/01/2003 08:55:39
 
 
To
13/01/2003 14:49:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00741115
Message ID:
00741382
Views:
27
>The best method is to do what Garret has suggested. You can make a function that does this for you. Something like this:
>
>
>lcOldError = on("error")
>llOpenError = .f.
>on error llOpenError = .t.
>use table1.dbf exclusive in 0
>on error &lcOldError
>if !llOpenError
>   * we opened the file exclusively
>else
>   * could not exclusively open file
>endif
>


Or, also as Garret suggested, for VFP8, something along these lines:
TRY 
   USE HOME(2) + "data\customer" IN 0 EXCLUSIVE
CATCH TO OERR
   MESSAGEBOX(TRANSFORM(OERR.MESSAGE) + CHR(13) + ;
      "LINE #:" + TRANSFORM(OERR.LINENO) + CHR(13) + ;
      "LINE:" + TRANSFORM(OERR.LINECONTENTS), ;
      16, "ERROR IN " + TRANSFORM(OERR.PROCEDURE))
FINALLY
ENDTRY


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform