473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Intermittent Error using FormTimer Event

I am, intermittently, getting the following error:
Error5 Invalid Procedure Call or Argument
>From Form_Timer
intCounter is Global, and OnLoad initialized to 0

Any Ideas ???
Private Sub Form_Timer() 'My Code
'************************************************* ***********
' FORM: Check for.ldb max of 10-seconds.
' TimerInterval = 1000 set for 1-Second
' intCounter is Global, and OnLoad initialized to 0
On Error GoTo Err_Handler
'Check for .ldb File
intCounter = intCounter + 1
If FileExists(Left(BEPathF, Len(BEPathF) - 3) & "ldb") Then
If intCounter >= 10 Then 'Exit after 10-secs
DoCmd.Close
End If
Else
'OK to BackUp and Copy since .ldb file is gone.
Me.TimerInterval = 0
Call BackUpAndCopyTo
DoCmd.Close
End If
Exit_Point:
Exit Sub
Err_Handler:
MsgBox "Report This Error-- " & Err.Number & " " &
Err.Description & " " & "Form_Timer"
DoCmd.Close
Resume Exit_Point
End Sub

Thanks
Greg

Apr 11 '07 #1
5 2127

You'll have to indicate what line generates the error. I don't see
anything obvious.

Apr 11 '07 #2
Hi Mike

I think it occurs in this portion of code. I need to learn how to
step through code, but the problem is intermittent and I've only had 2-
error occurances and can't seems to duplicate them. Also, I just
inserted a new shot-in-the-dark line of code.
Maybe, the 1-second delay is not long enough, and the timercode
becomes re-visited before the completion of the FileExists check?

Else
'OK to BackUp and Copy since .ldb file is gone.
Me.OnTimer = vbNullString ' <-- new line that might help ?
Me.TimerInterval = 0
Call BackUpAndCopyTo ' <-- possible err line?
DoCmd.Close
End If

Thanks
Greg

Apr 12 '07 #3
Hi Mike

I'm not sure, but believe it is coming from the following section of
code:

Else
'OK to BackUp and Copy since .ldb file is gone.
Me.OnTimer = vbNullString ' <-- New line of code, maybe this
will help?
Me.TimerInterval = 0
Call BackUpAndCopyTo '<-- Maybe the error is here?
DoCmd.Close
End If

Also, was thinking that the TimerInterval being set to 1000 may be too
short, and that the TimerCode is being re-visited before the
FileExists checks completes ???

Thanks
Greg

Apr 12 '07 #4
Also, was thinking that the TimerInterval being set to 1000 may be too
short, and that the TimerCode is being re-visited before the
FileExists checks completes ???
Possibly. File system actions can take a while especially over
networks, so
In Tools>Options change the error reporting level to (I think) Break
On All Errors. Using a breakpoint in a timer event is a pain in the
butt. Changing this setting will break to the error when it occurs.

If it does occur here, BackUpAndCopyTo, then we'd have to look at that
function to see what's wrong in it.
Me.OnTimer = vbNullString ' <-- New line of code, maybe this
will help?
Probably not. This line would be attempting to set the event handler
to nothing, which I'm pretty sure would cause an error when the form
is not in design view. Setting the TimerInterval to 0 is sufficeint to
stop the timer.

Apr 12 '07 #5
Thanks Mike

I discovered the problem. The 2 times that I recieved the error, I had
been testing the ExitRoutine in isolation. I discovered that my
Global Variables, assigned in the startup module, were holding their
values long after the code and module that assigned them had
concluded. I took it for granted that as long as the project was open,
it would stay that way. Actually, the values were held, but would
clear for reasons beyond me, and the error would occur at that point,
during the isolated module testing (intermittently- without
recognizable rhyme or reason). Oh well, case closed!

Anyway, on another note, the Timer issue I mentioned has me wondering?
Also, was thinking that the TimerInterval being set to 1000 may be too
short, and that the TimerCode is being re-visited before the
FileExists check completes ???
The FileExists code is shown below. I am not sure, but does the
Form_Timer continue
despite its own code. In other words, it seems like a pause in the
timer code stops the timer, but I'm not certain???

I was wondering if the FormTimer code pauses while the following
function call executes, despite the timer interval setting?

Function FileExists(strFileName As String) As Boolean
'************************************************* ***************
' Check for a File
On Error Resume Next
If GetAttr(strFileName) And vbDirectory Then
'it's a directory or does not exist
FileExists = False
Else
FileExists = True
End If
On Error GoTo 0
End Function

Apr 12 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Philip | last post by:
Hi, I have a problem with a win 2003 server Standard edition. Sometimes when I'm working in my web application the session hangs (but not the ASP-application). In the application log I find the...
9
by: Eddie J | last post by:
I'm getting an intermittent error when calling a .NET web service from a .NET console application. Both are using v.1.1.4322 of the framework. Any ideas on what could be causing this? It can...
2
by: deevoy | last post by:
Hi- I'm developing a asp.net web application and everything has proven fine on the dev and acceptance environment. We've moved the code up to our windows server 2003 prod environment and get the...
4
by: akhare1 | last post by:
OK, before I start, let me clarify a few things here. This is not the run of the mill failure to read a registry key while trying to write to the Event Log. Here's our setup: a) IIS 6.0...
2
by: Mike Krajewski | last post by:
We are having an intermittent problem using an ExecuteScalar command on a asp.NET page accessing SQL Server. 2 characters of the sql statement get intermittently altered. The code looks as...
1
by: deevoy | last post by:
Hi- I'm developing a asp.net web application and everything has proven fine on the dev and acceptance environment. We've moved the code up to our windows server 2003 prod environment and get...
8
by: Dave | last post by:
I am getting an intermittent database error on my asp page. I am using Access 2003 with classic ASP. The error is this: Microsoft JET Database Engine Error 80040e10 No value given for one or...
2
by: =?Utf-8?B?RGFycmVs?= | last post by:
I don't know if this is an ASP.NET issue, an IIS issue, or a user browser issue, but on one of our web applications we have been getting an increasing amount of 400 'Bad Request' errors. The...
0
by: C.W. | last post by:
Hi I have run into a really bizzare problem in that asp.net stops working intermittently - and I can only get it to restart after restarting my computer. My environment is Windows XP Pro SP2,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.