Re: Continuing when an Error occurs

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Bob Phillips (bob.phillips_at_notheretiscali.co.uk)
Date: 03/25/04


Date: Thu, 25 Mar 2004 22:54:52 -0000

James,

That should work. remember to reset after (On Error Goto 0).

If not try something like

    On Error Resume Next
    Set fld = rst.Fields("Adjustment")
    On Error Goto 0
    If Not fld Is Nothing Then
        holdamount = holdamount + rst.Fields("Adjustment")
    End If

-- 
HTH
Bob Phillips
    ... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Jmbostock >" <<Jmbostock.13p3mu@excelforum-nospam.com> wrote in message
news:Jmbostock.13p3mu@excelforum-nospam.com...
> I've a problem.
>
> The following is part of a procedure that takes information from an
> access database.
>
> If rst.Fields("One_Time_Fee") <> "" Then holdamount = amount +
> rst.Fields("One_Time_Fee")
>
> If rst.Fields("Adjustment") <> "" Then holdamount = holdamount +
> rst.Fields("Adjustment")
>
> The first one works fine. However, sometimes there are no adjustments,
> so the table doesn't create that particular field, and an error occurs
> saying correctly that there is not field by that name.
>
> I'm trying to write something that will skip that line of code if there
> is an error like that.
>
> I've tried using the "On Error Resume Next", but that doesn't seem to
> work.
>
> Anyone have any ideas??
>
> James
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>


Relevant Pages

  • strange behavior errorhandling
    ... I think you have to reset your error handling. ... except for A5 which is zero. ... End Sub ... >On Error GoTo ErIsGeenBestand ...
    (microsoft.public.excel.misc)
  • Re: Reset Find/Replace settings?
    ... I always reset it - ... On Error GoTo 0 ... I've tried recording macros every which way to catch how Excel might ... but no dice--seems like unless the user resets the ...
    (microsoft.public.excel.programming)
  • Re: Unexplained size increase
    ... add a .UsedRange to reset the UR to avoid misleading future use of ctrl-end ... Dim ws As Worksheet ... On Error GoTo 0 ... Hope that helps, RoyUK ...
    (microsoft.public.excel.programming)
  • Re: On Error Resume Next
    ... Err.Clear, On Error Goto, and On Error Resume ... Even though they do not reset the 'Resume' flag, ... Private Sub Command44_Click ...
    (comp.databases.ms-access)
  • Re: if table exist
    ... does any knows how can i check the existence of a table in a ms access database ?i need a sql statement that provide this function. ... Dim tdf As TableDef ... On Error GoTo 0 ...
    (comp.databases.ms-access)