PRB: REQUERY Function Reopens a View's Table ExclusivelyID: Q149000 The information in this article applies to:
SYMPTOMSIf you requery a view to refresh it with new data, the table with which the view is associated will be opened exclusively -- if it has been closed after the view was opened. This occurs even if SET EXCLUSIVE is off. Requerying a view opens the associated table if that table is not already open.
WORKAROUNDTo make sure that the table that is associated with the view stays open in shared mode, do not close the table after the view has been opened. For example, a form may close the table; and then the view gets requeryed. Another possible resolution to repopulating a control with new data is to set the rowsource (or recordsource) to an empty string, perform the requery and then set the rowsource or recordsource to the original value, as follows:
STATUSThis problem has been fixed in Visual FoxPro 5.0.
MORE INFORMATIONIf a view is opened and its associated table is not already open, the table will be opened exclusively or shared depending on current Visual FoxPro settings. For example, if EXCLUSIVE is set to Off, the table will be opened shared. If the table is closed while the view is still open, requerying the view with the REQUERY() function will open the table exclusively no matter what the EXCLUSIVE setting.
Steps to Reproduce Behavior1. Make sure EXCLUSIVE is set On by typing the following in the Command 2. Open the \Vfp\Samples\Data\Testdata.dbc database.
3. On the File menu, click New. Then click View, and click the New File 4. Select the Customer table from the Add Table or View dialog box.
5. Click the Fields tab, and then click the Add All button. On the File 6. On the Window menu, click View Window. Observe the tables as they are
After you reopen the view, the View_Customer view is open exclusively
because that is the only way a view can be opened. The Customer table will
be automatically opened when the View_Customer view is opened, and because
EXCLUSIVE is set Off, the WAIT WINDOW command shows it as being opened
shared. After you close the Customer table and call the REQUERY() function
on the view, the Customer table is opened exclusively even though EXCLUSIVE
is set OFF.
|
Last Reviewed: July 5, 1997 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |