Date:  07/06/2006 06:13:19 PM Msg ID:  003031
From:  FoxWeb Support Thread:  003025
Subject:  Re: perplexing intermittent error
Why are you specifying work areas by number when opening tables?  I'm including the the code of our OpenTable function, which we use in a bunch of our applications:
 

OpendDBFS.prg
  DO OpenTable WITH '.\database\people', 'PEOPLE', .F.

  DO OpenTable WITH '.\database\workOrders', 'WORKORDERS', .F.

RETURN .T.

 

 

***********************************************************
PROCEDURE OpenTable
  * Opens a table if it is not already open
  LPARAMETERS FilePath, Alias, Exclusive
  IF TYPE("M.alias") <> "C"
    M.alias = JustFName(JustStem(M.FilePath))
    IF '!' $ M.alias
      * Strip database delimiter
      M.alias = SUBSTR(M.alias, RAT('!', M.alias) + 1)
    ENDIF
  ENDIF
  IF USED(Alias)
    SELECT (Alias)
    IF FULLPATH(DBF()) <> FULLPATH(M.FilePath) OR (M.Exclusive <> ISEXCLUSIVE())
      IF M.Exclusive
        USE (M.FilePath) AGAIN ALIAS (M.Alias) EXCLUSIVE
      ELSE
        USE (M.FilePath) AGAIN ALIAS (M.Alias) SHARED
      ENDIF
    ENDIF
  ELSE
    SELECT 0
    IF M.Exclusive
      USE (M.FilePath) AGAIN ALIAS (M.Alias) EXCLUSIVE
    ELSE
      USE (M.FilePath) AGAIN ALIAS (M.Alias) SHARED
    ENDIF
  ENDIF
ENDPROC

 

FoxWeb Support Team
support@foxweb.com email

Sent by on 07/06/2006 02:04:09 PM:
Hello,

I'm getting a perplexing intermittent error:

 There was an error during the interpretation of your request.

Error #:              13
Message:         Alias 'WORKORDERS' is not found.
Program:         c:\inetpub\potter\stoutmarinedatabase\mgmt.fxp
Line #:         9
Line:         sele WORKORDERS

If I hit the browser's refresh the error vanishes and all works fine.

mgmt.fwx
line 8 =openDBFs()
line 9 sele WORKORDERS

opendDBFS.prg
if !used("PEOPLE")
  sele 1
  use .\database\people alias PEOPLE
endif
if !used("WORKORDERS")
  sele 2
  use .\database\workOrders alias WORKORDERS
endif
retu(.t.)