Cancel Property

InitialSelectedAlias

This property of the DataEnvironment determines which table is selected after the tables in the data environment have been opened.

Usage

frmForm.DataEnvironment.InitialSelectedAlias = cAlias cAlias = frmForm.DataEnvironment.InitialSelectedAlias
InitialSelectedAlias means you don't have to worry about the order in which you add things to the data environment. Just specify which one should be current when everything's open and set up.

There's one gotcha, though. The alias you specify is selected at the end of the OpenTables method (the internal part that you have no control over). If a method that fires later (like a control's Init) changes the work area, it isn't restored. For example, if a listbox is based on a query, the query is executed as part of the listbox's Init and the work area containing the query result becomes current. If you want to make sure a particular alias is current whenever you enter a particular form, use the form's Activate method to SELECT it. If you want it selected when the form first opens, put it in the form's Init (if there's only one form) or the formset's Init (when you have multiple forms).

Keep in mind that both the DataEnvironment's Init and the Form's Load come after OpenTables.

Example

* You'll normally set this one in the Property sheet * To bring up the propsheet for the DE, open the * DE window, then right-click on it and choose * Properties. Then, you can find the InitialSelectedAlias * property of the Data Environment and put something like: Customer

See Also

Activate, Init, Load Event, OpenTables, Select


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net