Solved

Access form refresh / re-calculation delay

Posted on 2013-05-20
3
955 Views
Last Modified: 2013-05-27
I have an Access database front-end with an SQL Server back-end. The main form consists of several sub-forms (containing simple totals) and various text-boxes, some of which are calculated based on sub-form totals.

It's actually a quoting application, whereby the sub-forms for materials / labour etc. are totalled up to give an overall cost, with additional input fields for discount / markup etc. The main 'quote' record is linked to several other tables for materials used, labour required etc. Normal sort of stuff I guess.

An initial problem meant that all the calculations were not correct if a user modified a field and then pressed print without the record being updated. To resolve this,  I now refresh/requery the form to ensure any field the user is currently in is updated and all calculations are correct (especially the overall quotation value of course). I found I had to add a fixed delay before printing to enable everything to refresh otherwise the printed quote did not correspond to the correct values on-screen. However, on some slower machines this is not long enough  - the delay is already up to several seconds which is getting a bit ridiculous as far as users are concerned.. normally pressing print should at least show a preview in a reasonable time.

Does anyone have any ideas how to resolve this, whether it be a better way of ensuring everything is up-to-date on the form before printing or telling me there's something obvious I've missed in all of this?

Thanks
0
Comment
Question by:nigelr99
3 Comments
 
LVL 24

Assisted Solution

by:chaau
chaau earned 150 total points
ID: 39182988
Didn't you need to do Update method, instead of refresh/requery?

Use Update with Force parameter set to TRUE. This will ensure the data is saved to the database
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 350 total points
ID: 39187168
How are you doing the "refresh/requery"? In most cases, if you want to force Access to save the data you just do this:

If Me.Dirty Then Me.Dirty = False

This forces Access to save any changes. Refreshing/requerying can take quite a bit of time, depending on many different factors (network speed, data size, UI complexisty. Saving data is very fast in most cases
0
 

Author Closing Comment

by:nigelr99
ID: 39199385
Sorry for slow reply, didn't have the chance to test for a few days. Taking the 2 replies I had, I realised that I didn't really need to requery as it meant the subforms were also requerying as well which seemed to take the most time.
In the end, I replaced the requery with a simple docmd.Save which seems to have done the trick for the time being.
I've awarded some points to each reply, hopefully the split is agreeable.
Many thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question