stuck in a loop

  • Thread starter Thread starter Benno
  • Start date Start date
B

Benno

Guest
can anyone help me with this....I am importing data from an external source (cms), the data appends to the table as it should and the empty date column is populated with the chosen date from the calendar...the problem is, i'm stuck in this loop and can't find what the problem is. I am receiving Error 20, whatever that might be?!?!?
Any help greatly appreciated. (i've obviously not posted all of my code here, just the bit where i get stuck in the god damn loop!)

On Error GoTo errh

Execution:

PauseTime = 1 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop

DoCmd.OpenTable "Ericsson", acViewNormal, acEdit = True
DoCmd.RunCommand acCmdPasteAppend
DoCmd.Close acTable, "Ericsson", acSaveYes
DoCmd.RunSQL "UPDATE Ericsson SET Ericsson.[StatsDate] = [Forms]![Form1].[script_date].[value] WHERE (((Ericsson.StatsDate) Is Null));"

errh:

Msg = "Error # " & Str(Err.Number) & " was generated by " & Err.Source & Chr(13) & Err.Description

Resume Execution
 
Last edited:
From the VB help files....


Resume without Error (Error 20) :

A Resume statement can only appear within an error handler and can only be executed in an active error handler. This error has the following causes and solutions:

You placed a Resume statement outside error-handling code.

Move the statement into an error handler, or delete it.

Your code jumped into an error handler even though there was no error.

Perhaps you misspelled a line label. Jumps to labels can't occur across procedures, so search the procedure for the label that identifies the error handler. If you find a duplicate label specified as the target of a GoTo statement that isn't an On Error GoTo statement, change the line label to agree with its intended target.
 
Benno,

On Error GoTo errh

Execution:

PauseTime = 1 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop

DoCmd.OpenTable "Ericsson", acViewNormal, acEdit = True
DoCmd.RunCommand acCmdPasteAppend
DoCmd.Close acTable, "Ericsson", acSaveYes
DoCmd.RunSQL "UPDATE Ericsson SET Ericsson.[StatsDate] = [Forms]![Form1].[script_date].[value] WHERE (((Ericsson.StatsDate) Is Null));"

'
' Add line of code, otherwise error 20 (or worse, resume at
' execution - endless loop)
'
Exit Sub ' <-- Do not "fall" into error handler


errh:

Msg = "Error # " & Str(Err.Number) & " was generated by " & Err.Source & Chr(13) & Err.Description

Resume Execution

hth,
Wayne
 
Benno,

I agree with Pat, you do not need your loop, or the timer
for that matter.

Also you must put the Exit Sub in or "fall" into your error
handler.

hth,
Wayne
 

Users who are viewing this thread

Back
Top Bottom