Solved

Form.Subdatasheet Expanded - No expansion if no child records?

Posted on 2006-10-23
7
1,336 Views
Last Modified: 2010-10-05
I have a subdatasheet/form that I'd like to automatically expand only when there are child records.  Does anyone know of a way to do this, maybe in code?  Form.Subdatasheet Expanded set to 'Yes' expands all of them...
0
Comment
Question by:WorthN
  • 3
  • 2
7 Comments
 
LVL 18

Accepted Solution

by:
Data-Man earned 300 total points
ID: 17790117
you can use this command to expand the sub datasheet view

docmd.RunCommand acCmdSubdatasheetExpandAll

You'll have to test for data first and then run the code.

Mike
0
 

Author Comment

by:WorthN
ID: 17790153
That was fast! Thanks.

This expands all SubDataSheets...  I'd like it to only expand the SubDatasheet if there is a child record.  Otherwise I get this unreadable mess with every parent record displaying sub record with new record line and headings.

Cheers
0
 
LVL 26

Assisted Solution

by:dannywareham
dannywareham earned 200 total points
ID: 17790170
Check the number of records:

(Air code)

If me.subsheetname.form.recordcout >0 then
docmd.RunCommand acCmdSubdatasheetExpandAll
End if
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 18

Expert Comment

by:Data-Man
ID: 17790184
Sorry, the it's either ExpandAll or CollaspeAll.

I no of no way to expand a single record.  

However, it there is a will there is a way.

Mike

0
 

Author Comment

by:WorthN
ID: 17790189
Thanks...  I'll give that a go.
0
 

Author Comment

by:WorthN
ID: 18156751
Just an FYI...  I'm still looking for a solution to this in case anyone comes across the answer.

Cheers!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question