Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Cetin Basoz
 To: Mark LaBarre
  Where is Mark LaBarre?
 Maryland - United States
 Mark LaBarre
Subject: RE: Unexpected behavior with REQUERY()
Thread ID: 373276 Message ID: 373282 # Views: 69 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Wednesday, March 20, 2013 7:05:35 PM         

> Hi folks,
> I encountered some unexpected behavior when REQUERY()-ing a parameterized view to refresh the "many" grid of a "one-to-many" grid pair. I figured out HOW to fix it but don't understand WHY it broke as it did.
> I set this up the kosher way, by passing the parent record's primary key to my parameterized view's WHERE clause to constrain the returned child records via a REQUERY() and then a REFRESH. Put this code in the AfterRowColChange method of the "parent" grid, and it constrained the records on the "child" grid just as expected.
> But only as long as both the "parent" and "child" grids were on the "same place" of my form! That is, initially just on the form itself. Then, I added a pageframe and put both grids on Page1. Everything still worked as advertised.
> And then as soon as I moved the "child" grid to Page2 of the pageframe where I want it to reside, it stayed blank no matter which row I selected on the "parent" grid on Page1.
> So I copied the REQUERY() and REFRESH code from the AfterRowColChange method of the "parent" grid on Page1, to the Activate method of the "child" grid on Page2. Moving it there fixed the issue and now the "child" records show up correctly when I tab from Page1 to Page2.
> A brief explanation of this behavior would help me understand WHY it quit working when I moved the "child" grid to another page on the pageframe. Many thanks in advance.

Simple answer is "pageframes" :) They never work as the rest of the controls. For example you can't simply refresh them calling thisform.refresh. You could use activate or UIEnable of a control on the page (maybe better since you can detect if the page is activating or deactivating).

Cetin Basoz

.Net has got better.Think about moving - check my blog:
My Blog

MongoDb Certified Developer
MongoDb Certified DBA

Support Wikipedia


Unexpected behavior with REQUERY() Posted by Mark LaBarre @ 3/20/2013 5:52:30 PM
RE: Unexpected behavior with REQUERY() Posted by Cetin Basoz @ 3/20/2013 7:05:35 PM
RE: Unexpected behavior with REQUERY() Posted by Don Higgins @ 3/21/2013 4:56:23 AM