Thanks guys. Here is the code.
Public Sub StopDunning()
'********************************************
'Date Last Modified: 08/14/08
'Purpose: Temporarily stop dunning
'Called By: MenuBar StopDun
'********************************************
On Error GoTo ErrorHandler:
Dim intDays As Integer
Dim strSQL As String, strDays As String
DoCmd.OpenForm "frmPopStopDun", , , , , acDialog
'could have canceled
If IsLoaded("frmPopStopDun") Then
If IsNull(Forms!frmPopStopDun!txtDays) Then
MsgBox "You must enter a value for days. Exiting with no
changes."
GoTo Exit_StopDunning
End If
intDays = Forms!frmPopStopDun!txtDays
DoCmd.Close acForm, "frmPopStopDun"
Else
GoTo Exit_StopDunning
End If
With Me
'save the current position and start of delay in dun tbl
strSQL = "INSERT INTO tblDunTempDelay ( CustNo, DunDate,
TempDelayStart ) " & _
"SELECT tblDun.CustNo, tblDun.DunDate, Date() AS Tstart " & _
"From tblDun " & _
"WHERE tblDun.CustNo = " & QUOTE & !CUSTNO & QUOTE & ";"
DoCmd.SetWarnings False
DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
If !Dunning Then
Call DunOff(!CUSTNO)
End If
!TempDelayEnd = DateAdd("d", intDays, Date) 'DateAdd("d", intDays,
Date)
'record to notes
!Notes = !Notes & vbCrLf & Date & " Started a Temp DunDelay today,
ending " & !TempDelayEnd & " ."
'had reset some cust flds in DunOff() or added TempDelayEnd to cust
even if not in dunning
.Requery
End With
Exit_StopDunning:
Exit Sub
ErrorHandler:
basUtilities.ErrorHandler Me.Name, "StopDunning"
Resume Exit_StopDunning
End Sub
frmPopstopdun has one field, txtDays. Two cmd buttons with code to cancel
or hide.
The function DunOff is called by 2 other procedures with no error. So I
think the error is in the above code. Please note the errorhandler does not
trap this error.
"Syntax error.... possible missing comma.." This error msg occurs after
exiting the procedure. In debug if stepping through every line of code you
[quoted text clipped - 3 lines]
line of code causes an error?
Waiting for Ike in Houston.