Requery Not Updating Control  
Author Message
SailorBob





PostPosted: Visual Basic Language, Requery Not Updating Control Top

I am using Access 2003. I have a subform on a form (form1). The record source for the subform is a complex query that has calculated fields in the query. The subform just displays the query values (it does not calculate fields in the subform).

When a process on another form (form2) executes, it updates data in a table that the subform (on form1) record source query is using for one of its calculated fields. When the form2 process adds a new row to the underlying tables of the subform query, a Subform.Requery will successfully show any new rows in the subform with all the values calculated correctly.

But when the form2 process just updates a single field of a table that is referenced in a calculated field in the query of the subform recordset, the Subform.Requery does not cause the new calculated value to be displayed. If I close and open the form (form1) with the subform all the new calculations show up correctly.

Any ideas



Visual Basic12  
 
 
Odd Arne





PostPosted: Visual Basic Language, Requery Not Updating Control Top

Someone having a clue

I have the same kind of problem...


 
 
ahmedilyas





PostPosted: Visual Basic Language, Requery Not Updating Control Top

showing some code would also help big time :-)

 
 
SailorBob





PostPosted: Visual Basic Language, Requery Not Updating Control Top

I discovered my problem. In essence the Requery event was being invoked with program logic sometimes and sometimes program logic was skipping the Requery statement. It was not a problem with the Requery method.

Do this test, with your subject form open, click design mode, then go right back to form view. Does your form now show the appropriate data If so, the requery method will show the appropriate data as well. If not, then I would recommend going into the underlying queries and make sure they have the correct data in them. If they do, then it may be a form control source problem or your code not updating a control the correct way.


 
 
Odd Arne





PostPosted: Visual Basic Language, Requery Not Updating Control Top

Thank you SailorBob,

You helped me solving my problem, it was a missing refresh I lacked...

It's often not necessary with codelines, sometimes it's better to explain the problem and *understand* what you are doing that does the trick ;)