Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select with a variable
Message
 
 
À
13/11/2000 04:16:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00434921
Message ID:
00440984
Vues:
13
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform