Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1354
  • Last Modified:

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

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
WorthN
Asked:
WorthN
  • 3
  • 2
2 Solutions
 
Data-ManCommented:
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
 
WorthNAuthor Commented:
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
 
dannywarehamCommented:
Check the number of records:

(Air code)

If me.subsheetname.form.recordcout >0 then
docmd.RunCommand acCmdSubdatasheetExpandAll
End if
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Data-ManCommented:
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
 
WorthNAuthor Commented:
Thanks...  I'll give that a go.
0
 
WorthNAuthor Commented:
Just an FYI...  I'm still looking for a solution to this in case anyone comes across the answer.

Cheers!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now