Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select with a variable
Message
 
 
To
13/11/2000 04:16:15
Gad Hutt
Express Print
Herzliya, Israel
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00434921
Message ID:
00440984
Views:
9
HI Gad,

First of all, you have to write this code in Form.Load or Form.DataEnvironment.BeforeOpenTables (or just add this table to DE).
Form Init usually is too late for this code.
If you have File is in use error, it means, that JobSheet table is already opened by another alias.

Ok, to be 99% save, try this code:
local lcOldError, lnError
lcOldError=on('error')
lnError=0
on error lnError=error()
 if used ('JobSheet') && This alias is already in use
    select JobSheet
 else
    use JobSheet in 0
    select JobSheet
 endif
on error &lcOldError
if lnError<>0 && Error, table was not opened :(
  =messagebox('Table JobSheet can not be opened. Try later...')
  return .f.
endif
** Rest of your code
HTH

>>> if used ('JobSheet') && This alias is already in use
>>> select JobSheet
>>> else
>>> use JobSheet in 0
>>> select JobSheet
>>> endif
>
>When I write the above in the command window (Only the ELSE clause, the used() returns .F. ...), everything works fine. But when I write the same lines in the init of a form I get the "File in Use" ERROR.
>What is wrong?
>
>Many thanks,
>Gadi Hutt
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform