[AccessD] Sub Subform not showing

David Emerson newsgrps at dalyn.co.nz
Tue Jul 7 14:42:16 CDT 2015


Charoltte,

Following up on your suggestion, at what stage do you suggest disabling
additions - Since I wouldn't want the user to see the form in an "Allow
Additions" state therefore it would need to be when the form opens.  I will
try this but I am not sure how this differs from having the property set on
the form to start with.

David

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Charlotte Foust
Sent: Wednesday, 8 July 2015 5:42 a.m.
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Sub Subform not showing

First off, if a parent object has no records, then its subform will have no
records.  It's always been that way, and if the Allow additions is set off,
you won't see either the parent or subform.  The simplest way I can think of
to handle this is to set Allow Additions on by default in the form/subform
and then use code on the Enter event to disable additions.

Charlotte Foust
(916) 206-4336

On Sat, Jul 4, 2015 at 2:51 PM, David Emerson <newsgrps at dalyn.co.nz> wrote:

> Hi Listers,
>
> I have an Access 2010 FE and SQL 2008 BE.  I have a form (frmClients) 
> that has a tab control with a number of tabs and subforms in each tab.  
> Most of the subforms have subforms of their own.  Record sources for 
> all the forms and subforms are set by assigning a ADODB.Recordset when 
> a record is selected from the main form (these filter the records 
> according to the main record selected).
>
> All is working well except for one subform (sfrSurvey) which has its 
> own subform (sfrResults).  All of the other subforms are set so that 
> records can be added but sfrSurvey has its Allow Additions property 
> set to no (records are added through a different process).
>
> When I open frmClient the first record happens to have a record in 
> sfrSurvey and this in turn shows records for sfrResults.  If I move to 
> another record in frmClient which has records in sfrSurvey then 
> records also show in sfrResults.
>
> If I move to a record in frmClient which does not have records in 
> sfrSurvey then sfrSurvey shows no records and the details section is 
> blank (which is expected).  Because sfrSurvey is blank then sfrResults 
> is not shown as well (as expected).
>
> Here is the problem: If I now move to a record in frmClient which does 
> have records in sfrSurvey the records are showing in sfrSurvey but 
> where the sfrResults subform should be is a white box.  It looks like 
> the sfrResults control doesn't have the Source Object property but 
> using VBA I can display the SourceObject property just before the 
> recordset is updated and it appears fine.
>
> The line of code where the problem appears is:
>
>         Set 
> Me!sfrQualitySurvey.Form!sfrQualitySurveyResult.Form.Recordset
> =
> rstTemp
>
> The error number is 2467 "The expression you entered refers to an 
> object that is closed or doesn't exist.".
>
> There is nothing in my code that purposely changes the SourceObject 
> property
> - the only changes are to the recordsource of the subforms.  None of 
> the other subforms have this problem.  I have tested by changing one 
> of the other subforms to not allow additions and it showed the same
problem.
> Changing it back to allowing additions solved the problem.  However, 
> for this particular subform I don't want to allow additions and would 
> prefer not to have the screen indicate that additions can be made only 
> to have the user told they can't if they try (by using code).
>
> Has anyone come across anything like this before?
>
> Regards
>
> David Emerson
> Dalyn Software Ltd
> Wellington, New Zealand
>
>
>
>
> --
> 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