Data Access Worldwide Knowledge Base

Article ID 2220
Article Title HOWTO: Get your own - or language dependent - flexerrs file to be used
Article URL http://www.dataaccess.com/kbasepublic/kbprint.asp?ArticleID=2220
KBase Category VDF11
Date Created 05/12/2006
Last Edit Date 06/30/2006


Article Text
PROBLEM:
I have added my application errornumbers and texts to a copy of flexerrs.dat that I copied in my application's datapath. The application sometime reports the text from my errors and sometimes not. I cannot find why?

ANSWER:
The table is opened by the virtual machine as soon as it starts. When the virtual machine starts, the path to find files is read from the registry (value dfpath) under HKEY_LOCAL_MACHINE\Software\Data Access Worldwide\Visual DataFlex\11.1\Defaults. This path usually contains the USR directory of your Visual DataFlex installation where the original flexerrs.dat (translated if you picked a non-english language at setup) resides. This is the flexerrs.dat that is opened and it does not contain - of course - the error numbers and texts from your project/workspace.

If your application starts the search path for files is changed by the workspace object but flexerrs is open already and the path to the opened files will not change. You cannot close flexerrs directly because it is not opened with an OPEN stratement. So how do you make the virtual machine open your modified flexerrs?

You can do this by telling the virtual machine to read the error text from an error that is not in flexerrs.dat range but in one of the DFERRnnn.dat files. If the virtual machine reads from that table it closes flexerrs internally. If after this you use an error number from the range of flexerrs.dat (1-4096), you will get the right information.

You can use the following code:

Procedure DoReOpenFlexerrs
    String sVoid
    
    If ((LastErr / 4096) = 0) Begin
        // Flexerrs.Dat is the opened errorfile
        // Switch to dferr001.dat
        Move (Error_Text (Desktop, 4097)) To sVoid
    End
    Else Begin
        // Dferr001 ... Dferr007 is the opened errorfile
        // Switch to flexerrs.dat
        Move (Error_Text (Desktop, 100)) To sVoid
    End
End_Procedure // DoReOpenFlexerrs

You can call this routine from the OnCreate procedure in your application object. Place the code BELOW the line:

    Send DoOpenWorkspace CURRENT$WORKSPACE

Note:
Flexerrs.dat is an embedded database table and needs to stay so (see KB 1262)


Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu

Web Links Related to this Article
DAW Knowledge Base article 1262: INFO: Converting FlexErrs, etc. to different databases
URL=http://www.dataaccess.com/KBPrint.asp?ArticleID=1262


Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.