Solved

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

Posted on 2006-10-23
7
1,332 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

810 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