Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2006

Tip: Looking for answers? Try searching our database.

Requery control not working correctly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian - 02 Feb 2006 20:18 GMT
I have a calculated control at the bottom of a continuous form to show totals
of a couple of fields. In order to ensure that they display the correct
information, I have this in Form_AfterUpdate:

Control1.Requery

However, after I update a record on the form and navigate to a new record,
Control1 does not update correctly. If I nagivate back onto the record that
was changed, they do show the correct totals, but then it changes back to the
pre-update total when I navigate back to any other record. In fact, if I
change multiple records, the calculated control contents will be different
based on which record I enter! Very odd behavior.

Requerying the entire form, Me.Requery, works correctly, but that is not a
solution as it will become slower as more data is entered because the form &
footer fields are based on a filtered list of records. Closing & reopening
the form also works.
Requerying the individual controls should work, and I have it working in
many other apps.

Here is the control source of the calculated control. The Filter1 refers to
an unbound combo box on the form that is used to filter the records based on
Field1.

=IIf(IsNull([Filter1]),0,DSum("[Field2]","[Table1]","[Field1] = " &
[Filter1]))

The IsNull is necessary because the criteria clause will generate an error
if the Filter1 control is null, as it is when the form is opened.
Klatuu - 03 Feb 2006 15:09 GMT
Move your code to the Current event.  The After Update does not fire until
the current record has been updated.  The Current Event fires when you change
records.

> I have a calculated control at the bottom of a continuous form to show totals
> of a couple of fields. In order to ensure that they display the correct
[quoted text clipped - 25 lines]
> The IsNull is necessary because the criteria clause will generate an error
> if the Filter1 control is null, as it is when the form is opened.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.