[AccessD] Access crashes when assigning empty recordset

Darryl Collins darryl at whittleconsulting.com.au
Tue Sep 11 20:35:14 CDT 2018


Yes,  That would be where I would start too given it seems to be the cause of your issue.


-----Original Message-----
From: AccessD <accessd-bounces at databaseadvisors.com> On Behalf Of Charlotte Foust
Sent: Wednesday, 12 September 2018 11:14 AM
To: Access Developers discussion and problem <accessd at databaseadvisors.com>
Subject: Re: [AccessD] Access crashes when assigning empty recordset

I suppose it might be possible that setting the frm.recordset to nothing leaves you in a state where you cannot assign a recordset to it.  What happens if you comment out that line?  Does it give you the same error or a different one?  And what is the error?  Honestly, I can't recall every trying to set a subform's recordset.


Charlotte Foust
(916) 206-4336


On Tue, Sep 11, 2018 at 12:56 PM Fred Hooper <fahooper at gmail.com> wrote:

> I'm debugging an A2003 front end to a SQL Server 2017 back end. All 
> data sourcing is though stored procedures, using ADO; all associated 
> code is centralized. I'm filling a subform; which of two subforms is 
> filled depends on a value in the parent form. The unused subform is 
> disabled and hidden.
>
>   * As I move through the records of the parent form the subforms fill
>     correctly.
>   * When I add a new record of each type, both work correctly.
>   * When I attempt to change the type for a record the crash occurs.
>       o The code to do so is the same code as the first two items above
>       o Here are the steps:
>           + Create the recordset -- works properly
>           + Code that assigns the recordset:
>
> frm.RecordSource = ""
> Set frm.Recordset = Nothing
> If rst.State = adStateOpen Then
> Set frm.Recordset = rst -- it crashes here!
> rst.CLOSE
> End If
> Set rst = Nothing
>
>           + These disconnected recordsets work perfectly everywhere (so
>             far) except for this; if they are created with optimistic
>             locking they are editable and can be appended to, if read
>             only they are that. All use a client side cursor and are
>             loaded forward only -- but navigable in the forms.
>           + It is crashing only on loading an empty recordset, but with
>             anything except switching the value in the parent form empty
>             recordsets load without issue. The changing value in the
>             parent form isn't referenced anywhere in the loading code;
>             it just affects which code is executed.
>           + In looking at the recordset at the crash point it has (1)
>             zero records; (2) EOF = True; and, (3) BOF = True -- all the
>             expected values.
>           + An identical empty recordset in the master record created
>             with the value I'm changing to has records added without any
>             problems.
>   * In writing this I realized that I can write a stored procedure to
>     make the change in the database and reload the form. I'm confident
>     that will work, but it seems kludgy.
>
> Any ideas?
>
> TIA,
> Fred
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list