Solved

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

Posted on 2006-10-23
7
1,337 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

713 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