Subject Re: Data refresh in a grid
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Mon, 31 Jan 2022 10:39:23 -0800
Newsgroups dbase.getting-started

On 1/31/2022 9:48 AM, Mervyn Bick wrote:
> On 2022/01/31 19:19, Milind Nighojkar wrote:
>> Scenerio :
>> 1.In form1 DOJ is a date field in grid  . (Say current row position is
>> 10)
>> 2. DOJ's  values is being inputed by opening  another form2 .
>> 3.Input is thru Datetimepicker  in form2. Form2 is closed
>> 4.After closing form2 value for DOJ in row 10 of  form1 is not refreshed.
>> (In form1 when row navigation is changed and re-entered in row 10 then
>> the value is seen to be updated.)
>>
>> Any suggestions as to how the form1 grid row is updated or refreshed
>> the moment cursor come back to form 1
>>
>> Milind Nighojkar
>
> I assume your form2 has it's own query object to access the table.  If
> so, form2 is writing the data to the table but form1 will not see that
> data until its query is requeried.
>
> Unfortunately I can't put a little example together for you right now
> but this is what you need to do.
>
> If you are launching form2 using readmodal() you can simply add a line
> below the readmodal() command.
>
>     form.queryname.requery()
>
> When you open a second form with readmodal() all processing in form1
> stops until form2 is closed so the requery() doesn't happen until the
> new date has been selected and saved.
>
> If you are using open() to launch form2 this approach won't work.
>
> In form1's onOpen event handler
>
>       set procedure to form2.wfm
>       form.form2 = new form2form()
>       form.form2.parent = form
>
> In form2 in the datetimepicker's onChange event handler
>
>      this.parent.parent.queryname.requery()

You may not even need a requery, but instead:

this.parent.parent.queryname.rowset.refreshControls()

Ken


--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm