Connecting Tech Pros Worldwide Forums | Help | Site Map

"Calculating..." when form opened

Newbie
 
Join Date: Aug 2007
Posts: 31
#1: Mar 3 '09
Hello,

I have an Access application with a number of forms. On opening one particular form, the application will sometimes appear to get stuck in a loop with 'Calculating...' in the status bar for some time. This is a problem when using the database on a server, since it seems to be running the same query over and over again.

There is one form in particular I have a particular problem with. Both its form and subform are opened using WHERE filter criteria, using a string filter on Standards.refStd.

Standards are linked to Narratives in a many-to-many relationship, i.e. there is a link table called Link-NarraStand that has the primary key of Standards in one column and Narratives in the other.

In the main form, there are a couple of DLOOKUPs in text boxes on the form.

MAIN FORM SQL:
Expand|Select|Wrap|Line Numbers
  1. SELECT KLOEs.RefKLOE,
  2.        KLOEs.HeadingsRef,
  3.        KLOEs.DescKLOE,
  4.        OfficersKLOE.DescOfficer AS KLOEOfficer,
  5.        KLOEs.Element,
  6.        Themes.RefTh,
  7.        Themes.DescTheme,
  8.        Questions.RefQ,
  9.        Questions.DescQ,
  10.        Questions.Timescale,
  11.        Standards.RefStd,
  12.        Standards.StdExcellent,
  13.        Standards.StdFair,
  14.        Standards.SA,
  15.        Standards.[L4-DateStart],
  16.        Standards.[L4-DateEnd],
  17.        Standards.[L4-DateActual],
  18.        Standards.L4Team,
  19.        SAlevels.DescSA,
  20.        SAlevels.DescPlan,
  21.        Standards.Officer,
  22.        Standards.OfficerAudit,
  23.        Standards.L4weight
  24.  
  25. FROM ((KLOEs LEFT JOIN Officers AS OfficersKLOE ON KLOEs.Officer = OfficersKLOE.RefOfficer) LEFT JOIN Themes ON KLOEs.RefKLOE = Themes.KLOE) LEFT JOIN (Questions LEFT JOIN (SAlevels RIGHT JOIN Standards ON SAlevels.RefSA = Standards.SA) ON Questions.RefQ = Standards.Question) ON Themes.RefTh = Questions.Theme
  26.  
  27. ORDER BY KLOEs.RefKLOE,
  28.          Themes.RefTh,
  29.          Questions.RefQ,
  30.          Standards.RefStd;
SUBFORM SQL:
Expand|Select|Wrap|Line Numbers
  1. SELECT [Link-NarraStand].*,
  2.        qL5NarrativesW.L5order,
  3.        qL5NarrativesW.Level,
  4.        qL5NarrativesW.Status,
  5.        qL5NarrativesW.TextNarrative,
  6.        qL5NarrativesW.TextNarrative2,
  7.        qL5NarrativesW.DateStart,
  8.        qL5NarrativesW.DateEnd,
  9.        qL5NarrativesW.DateComplete,
  10.        qL5NarrativesW.Progress,
  11.        qL5NarrativesW.Officer,
  12.        qL5NarrativesW.Archive,
  13.        qL5NarrativesW.EvidenceLink,
  14.        qL5NarrativesW.WeightL5,
  15.        qL5NarrativesW.L5wgtprog,
  16.        qL5NarrativesW.ModifiedOfficerL5,
  17.        qL5NarrativesW.DateModifiedL5,
  18.        qL5NarrativesW.RefManager,
  19.        qL5NarrativesW.NameManager,
  20.        qL5NarrativesW.DisOfficer,
  21.        qL5NarrativesW.DisDate
  22.  
  23. FROM [Link-NarraStand] LEFT JOIN qL5NarrativesW ON [Link-NarraStand].Narrative = qL5NarrativesW.RefNarrative
  24.  
  25. ORDER BY qL5NarrativesW.L5order,
  26.          qL5NarrativesW.DateStart,
  27.          qL5NarrativesW.DateEnd;

NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,727
#2: Mar 3 '09

re: "Calculating..." when form opened


Quote:

Originally Posted by jonnyboy View Post

I have an Access application with a number of forms. On opening one particular form, the application will sometimes appear to get stuck in a loop with 'Calculating...' in the status bar for some time. This is a problem when using the database on a server, since it seems to be running the same query over and over again.

What causes you to think the delay is any more than the SQL running normally?
Newbie
 
Join Date: Aug 2007
Posts: 31
#3: Mar 4 '09

re: "Calculating..." when form opened


Thanks for replying, NeoPa.
When the form opens, it displays the correct records in both the main form and the subform almost immediately.
However, the form seems to be refreshing itself over and again for quite a while, with "Calculating..." in the status bar, which impedes data entry and slows the application right down.
If I select the main form and hold F5, there is a similar effect, although there's nothing in the code that's asking the forms to refresh.
FishVal's Avatar
Expert
 
Join Date: Jun 2007
Location: Israel
Posts: 2,584
#4: Mar 4 '09

re: "Calculating..." when form opened


Quote:

Originally Posted by jonnyboy View Post

.... although there's nothing in the code that's asking the forms to refresh.

Access doesn't need something asking it to refresh form / table grid / query grid nor it listens to something asking it not to do it.
Moderator
 
Join Date: Feb 2008
Location: Beauly, near Inverness, Scotland
Posts: 1,576
#5: Mar 4 '09

re: "Calculating..." when form opened


Hi. I think you are making an incorrect asumption that the problem relates to form refresh. I have experienced very similar issues with a form where I used an unbound textbox to display the entry date of the last record entered. This used a DLookup of a simple Max query returning the latest incident date within the set of 130,000 records. Across the network its performance was very, very slow (not surprising as Access is not client-server based). Because the unbound textbox update was in progress the 'Calculating...' message was on screen for over 30 seconds, and the whole application was more or less unusable in that time.

As a quick check, copy the form involved and on that test copy remove the textboxes with the DLookups, or substitute a specific value for test purposes. See if that modified copy of the form opens without the Calculating... message staying on. If it does, it is the network traffic involved in the asynchronous query launched by the DLookup that is causing the slowdown in performance.

I should make it clear that the use of the domain aggregate function Dlookup is not the issue here; my slowdown was as a direct result of the network traffic resulting from running the query underlying the Dlookup, which was evident whenever I ran the query by itself across the network. When I ran the same query on a non-network copy of the DB there were no performance issues at all, and hence the unbound textbox update did not cause delays when testing.

In my case I could not resolve the problem by changing the query concerned, no matter what I tried. In the end I removed the unbound textbox altogether...

-Stewart
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,727
#6: Mar 4 '09

re: "Calculating..." when form opened


Another possibility might be that, for quite large recordsets, Access will first return a subset of records to be getting along with, before it then goes off to retrieve the rest.

Try this with a large query that has a sort order different from any of its indexes. You will notice the same behaviour (The last record number won't display until all the records have been returned). It seems feasible to me that this explains your extended delay after the forms show up as expected.
Newbie
 
Join Date: Aug 2007
Posts: 31
#7: Mar 5 '09

re: "Calculating..." when form opened


Hello again NeoPa, Stewart.

Thanks again for replying so promptly. You're making a really valuable contribution.

I'll check out the indexes situation, and whether I have indexes on those fields I'm looking to sort on.

Jon
Reply

Tags
access, calculating, loop