Solved

Sleep vs Timerinterval

Posted on 2011-03-02
9
705 Views
Last Modified: 2012-08-13
Which is better (or are they the same) Sleep or Timerinterval? I have a form where onCurrent I need to establish some variables, count the # of days based on a couple dates, and a couple of other calculations.

I also have code behind the column headings (on a continuous form) to sort the contents of the column --

if me.orderby="FieldName" then me.orderby="FieldName DESC" else me.orderby = "FieldName"

The onCurrent bogs down the sort -- so I put the culprit code in a timer -- but it still seems that things keep running too slowly.

I have tried Application Echo and the DBEngine.Idle dbRefreshCashe ---

Nothing seems to work.

This is not a large db. It's a FE/BE (.accdb) with about 8 users consecutively. The BE never grows beyond 30mb.

The form is bound because it requires real-time updates available to all the users.

Any suggestions that would help me speed things up would be appreciated.

Thanks a lot!!



0
Comment
Question by:Ei0914
  • 4
  • 3
  • 2
9 Comments
 
LVL 2

Expert Comment

by:ComputerAidNZ
ID: 35018788
Sleep performs its code after a certain time - once; TimerInterval repeats the process after specified time, again and again.
Probably best to use OnForm, since this will run the code every time the form is opened - don't use OnTimer since this can cause issues.
0
 
LVL 75
ID: 35018854
But why would the sorting be affected but the code in the current event, which is only going to execute when you open the form and/or go to a different record.  You wouldn't be clicking the column sort during that time, right?
Also ... this is why I started using datasheet views instead of continuous forms a long time ago, to take advantage of all the built in right click sort/filter etc.  I used to do the column sort thing also.

Overall, not seeing why you would need a timer or Sleep for any of this ...?
0
 

Author Comment

by:Ei0914
ID: 35018956

When you resort a form the OnCurrent event fires because a new record becomes "Current" upon sort.

This is a Dispatch Management system with several dispatchers moving through the records and assigning drivers, calculating charges/fees based on # days out (when initial order was entered to when the dispatcher says the move is completed), etc. It's a truly real-time application.

We thought this might be a networking issue: so, they replaced the NIC card. This client gets access to their server (as they are a branch office) through Remote Desktop. Initially, when I took over support of the application, all the users had their own copy of the front-end, all in the same directory on the server.

So I created a batch file to copy the FE to the users local C: drive (in their Remote Desktop Session) which may not have any impact since the C: drive in that scenario is virtual -- and the processing is probably dragging down server performance regardless of where it is --- am I right about that or not? I'm not a network specialist and they don't have one on staff to help with me that question.

I wouldn't need a Timer if the performance of the form was so poor. I'm trying to put some of the calculation off to the side if possible (which is why I am using the Timer) ---

It is also a tabbed form - and as they change tabs the recordsource changes -- a delay there is acceptable. But in one tab -- where there are only 30-40 records, you'd think there were a million records in the view the way the form is performing.

I want to eliminate anything I may be doing before putting the "blame" on the network or hardware. I would appreciate any suggestions on how best to handle this with regard to the remote desktop too.

Thank you so much for responding, and for your help. I'm ready to pull my hair out.

Eileen
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

Author Comment

by:Ei0914
ID: 35018972
Opps : I wouldn't need a Timer if the performance of the form was'nt so poor.
0
 
LVL 2

Accepted Solution

by:
ComputerAidNZ earned 250 total points
ID: 35019012
When  I'm troubleshooting code such as you are doing I put the code in a button and fire it manually, iron out all the bugs, then move the code to an event, then delete rthe button.  BUt the manual firing will show if it is the code of the event that is causing the error.  PS I've had numerous issues with MS Access timer events and coding issues that are OFTEN cured by re-creating the form from scratch and slowly adding the code to the new form.  What happened I don't know, but it obviously solved the issues MANY times
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) earned 250 total points
ID: 35019182
Well, I have to agree that ...  the Timer event can be problematic at times.

"- am I right about that or not?"
I really don't know.  Really have not done anything with RD ... one client has a Terminal Server setup and that is fast.

What is the nature of the code running in the On Current event?
0
 

Author Comment

by:Ei0914
ID: 35020045
Thanks you guys/gals(?) -- I'll try that. I'll split the points. I appreciate your help. If you can think of anything else, I'd be happy to hear about it.

Eileen
eileen@epmconsultinginc.com
0
 

Author Closing Comment

by:Ei0914
ID: 35020084
Rec'd great direction. Thanks as always!
0
 
LVL 75
ID: 35020134
guy :-)
mx
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL - Cumulating field values to one field 5 19
zero pad a access form field 2 14
Any Way to Print an Import Spec? 3 28
Criteria for Date for DCount 4 16
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now