Solved

Sleep vs Timerinterval

Posted on 2011-03-02
9
706 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 

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 - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

808 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