?
Solved

Access form refresh / re-calculation delay

Posted on 2013-05-20
3
Medium Priority
?
1,181 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 25

Assisted Solution

by:chaau
chaau earned 450 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 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1050 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

749 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