Re: Application crashes with "On Error Resume Next"

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

From: Dean B (dean_at_forsail.co.uk)
Date: 11/05/04


Date: 5 Nov 2004 03:53:02 -0800

Matt,

thanks for your reply.
The code is intended to move data from one recordset to another -
however the "ChangedCarveOuts" recordset is built using a stored proc
and contains a subset of the fields in "ChangedDetails".

So when it gets into the For Next loop, there may be fields in the
"ChangedDetails" recordset that are not present in the
"ChangedCarveOuts" recordset. The intention of the On Error Resume
Next is then to allow the app to skip any potential 3065 (Item cannot
be found ..) errors which I know will occur, rather than coding each
field.

The application in fact dies when it hits a field ("BenchmarkId")
which is used in "ChangeDetails" but not in "ChangeCarveOuts". In the
IDE, it skips the error and moves on. Null values are present in the
data and are allocated normally before it actually dies at the
"BenchmarkId" field

We could recode the app so that only the fields used are set, but the
app is live at a client, was working normally, and this issue then
started to occur. Having got more info from the client, it appears
that they have just recently upgraded to XP from Windows 2000 Pro, and
it was working before the upgrade but not after. The app was developed
in an XP pro environment so has been compatible up until this point.

Obviously, this suggests something in the XP upgrade, but if I could
find a MS patch/hotfix that refers to this issue that would be ideal!
Any thoughts?

Thanks,
Dean.

"Unicorn" <unicorn@somewhere.com> wrote in message news:<#16A3jmwEHA.3292@TK2MSFTNGP15.phx.gbl>...
> Dean, Am I just getting blind, or does this code actually do nothing.
> You take a field out of the collection and set it's value to itself, or is
> it that the .fields collection is in another recordset?
> If it is another recordset, I think that it just might be the actual data
> that is causing the problem, something like a Null or a null embedded in the
> data.
>
> This does appear to be a rather laborious way of populating a recordset.
>
> Matt
> "Dean B" <dean@forsail.co.uk> wrote in message
> news:ffa06c52.0411030159.6afb11e5@posting.google.com...
> > The following section of code (there is more code before and after
> > it), when run within an Exe at a client site, causes the app to crash
> > and produce an XP exception error (Code 0xc0000005).
> >
> > With ChangedCarveOuts.DetailRecordset
> > .AddNew
> > On Error Resume Next
> > For Each objField In ChangedDetails.DetailRecordset.Fields
> > .Fields(objField.name).value = objField.value
> > Next objField
> > On Error GoTo cmdAdd_Click_Error
> > End With
> >
> > The "on error resume next" has been put in at this point as there are
> > a number of objField elements which do not correspond to anything
> > within ChangedCarveOuts.DetailRecordset (otherwise it would report an
> > error 3065 "Item cannot be found in the collection corresponding to
> > the requested name or ordinal.") So the idea behind the "On Error
> > Resume next" is that the app just skips the ones that we don't want.
> > This works fine in my vb environment, and also at a number of other
> > sites.
> >
> > By adding a trace to the code, I managed to determine that the
> > application runs through the For-Next loop normally a number of times,
> > but then dies when it comes across the very first 3065 error in the
> > ".Fields(objField.name).value = objField.value" line. (The bit its
> > meant to ignore)
> >
> > The app uses MSADO 2.0 & SQL Server 2000 database with an ODBC
> > connection.
> >
> > The client uses XP Professional with MDAC 2.71.9030.0. I have,
> > however, ran the app on a machine at the client site that uses MDAC
> > 2.61.7326.6 and it works fine. This would suggest an issue with MDAC
> > 2.71, but I can find nothing in any of the groups or the web related
> > to this MDAC version to suggest that it is at fault.
> >
> > Any help would be REALLY, REALLY appreciated.
> >
> > Thanks.



Relevant Pages

  • Re: Access 2007 - Anyone having trouble with really large conversions?
    ... I have a fairly large app, ... program, which has added even more forms, queries and linked tables. ... get errors when opening a recordset for a linked table. ... So Access 2007 always seems to use Recordset2 objects for its forms and reports ...
    (comp.databases.ms-access)
  • Re: Using Access with MySQL and Stored Procedures as source to Forms and Reports
    ... and retrieval in sprocs / views. ... app with code. ... If I were to use a BE server for a web based application than I would ... recordset I use code to modify it. ...
    (comp.databases.ms-access)
  • Re: Datareader, dataset, else?
    ... A DataReader is most closely analogous to a Read-Only/Forward-Only Recordset ... > I'm writing my first real asp.net app at my job, ... > seems like I have to choose between using a SQldatareader or a dataset. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Accessing External data
    ... I need to save data from an Access APP with no TABLES ... The values of the subform's controls TAG need to be saved / loaded. ... The MASTER Form and the rest of the APP looks at CONstants - which I'd like ... I'm struggling to create a recordset here ...
    (microsoft.public.access.modulesdaovba)