Re: Continuing when an Error occurs
From: Bob Phillips (bob.phillips_at_notheretiscali.co.uk)
Date: 03/25/04
- Next message: Jon Peltier: "Re: VB Custom Chart Creation"
- Previous message: jaf: "Re: How to cause Excel to trigger a procedure without the user opening a workbook."
- In reply to: Jmbostock: "Continuing when an Error occurs"
- Next in thread: Jmbostock: "Re: Continuing when an Error occurs"
- Reply: Jmbostock: "Re: Continuing when an Error occurs"
- Messages sorted by: [ date ] [ thread ]
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/
>
- Next message: Jon Peltier: "Re: VB Custom Chart Creation"
- Previous message: jaf: "Re: How to cause Excel to trigger a procedure without the user opening a workbook."
- In reply to: Jmbostock: "Continuing when an Error occurs"
- Next in thread: Jmbostock: "Re: Continuing when an Error occurs"
- Reply: Jmbostock: "Re: Continuing when an Error occurs"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|