Solved

Access form refresh / re-calculation delay

Posted on 2013-05-20
3
932 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server 2012 - Merge Replication Issue 1 19
Sql Server group by 10 26
VB.net and sql server 4 33
Whats wrong in this query - Select * from tableA,tableA 11 28
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

786 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