Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error on timer event, division by zero AccessRuntime

Status
Not open for further replies.

markphsd

Programmer
Jun 24, 2002
758
US
I'm using Access Runtime 2002. Most machines are running windows 2000 others run XP, they run fine.

Problem: Sometimes(ever couple of months) there is maybe 1 or at most 2 machines that give runtime error codes on the event timer(a timer that loads forms on the db opening). But other computers using the same app show no error. It rarely occurs, and I haven't been able to figure out a soltion other then reinstalling windows.

Attempts to solve the problem: I've reinstalled Access Multiple times. I've tried to fix the app, recompile, compress re-make the mde file. There seems to be no answer. Has anyone run into the same problem? It only seems to occur with the on timer event. This last time it gave me "Division By Zero", but i'm not dividing or calculating anything.

I know this post seems disjointed, but so am I over this.
Mark P.

Bleh
 
I am going to bet that the error messages that you are receiving are actually from the loading of the forms. Like a form is opened and a query or a calculated control has a expression in it that that performs a division. This calculation is attempting to divide by Zero. You see even though your On timer event is executing it is really the forms controls or the Record Source queries that are causing you the problems.

I recommend that you look at all of your queries calculated fields, your forms calculated controls, and the VBA code in the On Load or On Open event procedures where division of values is taking place. Guard against the divide by zero by using IIF statements.

Let me know if you find the problem and need help solving how to guard against it. Bob Scriver
 
Thanks for the response Scriverb,

What does that mean anyways, scriverb ....

Okay, so I wasn't completly forthright. I believe it might be one of the forms as well, however... I have an indicater loading label that tells what is loading. It seems one form in particalar causes the problem. However, the form has no onload or onopen events no special controls.. I can Load all the forms in order manually and not get the error. I can load the form seperately and not get the error.

I have also rearanged the order they are loaded.. it seems to be this particaler form where the loading fails. The only reason I don't think it's the form is, it doesnt bring up a error when loading alone. Also, it is based on a table, not a query. There is a subform that is attached, but it too has no on load events, or on open.

Perhaps i should re-write the form. It's probably just one of those odd things that has no definable reason for error. Anyways, if that's what it is, I'll post a "nevermind this post"


thanks

Mark P.

Bleh
 
Maybe as you recreate the form you will find where there is a division taking place and you will see the problem. I have always guarded against the division by zero by using an IIF statement:
IIF(x = 0, 0 , y/x)

These are the kind of problems that will keep you up at night.

Good luck.

PS: My old office user name scriverb stands for lastname + first initial of first name (i.e. Bob Scriver) Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top