How to Change Fields to Use Memory Variables, Not Aliases

Last reviewed: April 30, 1996
Article ID: Q119792
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6, 2.6a
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
  • Microsoft FoxPro for Macintosh, versions 2.5x, 2.6a
  • Microsoft FoxPro for UNIX, version 2.6

SUMMARY

This article explains how to change all variables from having aliases to memory variables. For example, suppose the field on the screen has CUSTOMER.CNO for input and M.CNO is wanted instead. There is no dialog box in the interface that allows the variables to be globally changed.

MORE INFORMATION

There are two ways to change the variables:

  • Double-click each field and manually remove the name of the database and the period. Then add "m." (without the quotation marks) before the name of the variable.

    -or-

  • Edit the screen file by issuing the following commands in the Command window:

          CLOSE ALL                && closes all open windows and tables
          USE <screen name>.scx    && opens screen file as a database file
          REPLACE name WITH ;
            "m."+STRTRAN(name,<table name in quotes>+".","") ;
            FOR objtype=15         && replace table alias with "m."
          USE                      && close screen file
    
       NOTE: This sample code is limited to changing GET fields and will
       only work with screens that are based on a single table.
    
    
The following steps set up a sample screen and show how to implement the second option above.

  1. Open the CUSTOMER table that is located in the FoxPro TUTORIAL subdirectory.

  2. From the File menu, choose New, select the Screen radio button, and choose the New button.

  3. From the Screen menu, choose Quick Screen.

    A small window with the title "Quick Screen" appears.

  4. Make sure that the Add Alias check box is selected.

  5. Choose OK.

  6. Double-click one of the fields. Note that "customer.<field name>" appears. Choose the Cancel button.

  7. Press CTRL+W to save the screen.

  8. Save the file as TEST.SCX, and save the environment when prompted.

  9. In the Command window, type the following command and press ENTER:

    USE test.scx

  10. In the Command window, type the following command and press ENTER:

    REPLACE name WITH "m."+STRTRAN(name,"customer.","") FOR objtype=15

  11. In the Command window, type the following command and press ENTER:

    USE

Open the TEST.SCX screen and note that instead of having CUSTOMER.CNO, CUSTOMER.STATE, CUSTOMER.YTDPURCH, the input for the fields on the screen are M.CNO, M.STATE, and M.YTDPURCH.

REFERENCES

Microsoft FoxPro 2.6 for MS-DOS "Update" page 4-32 and Microsoft FoxPro 2.6 for Windows "Developer's Guide" page A-32.


Additional reference words: FoxUnix FoxMac FoxDos FoxWin 2.50 2.50a 2.50b
2.50c
2.60 2.60a
memvar
KBCategory: kbenv kbprg kbcode
KBSubcategory: FxenvMemory


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT 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.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.