How do you make Expandable & Collapsible sections in Microsoft Access 2007 Forms

I'd like to be able to hide or expose a section of a form in case users want to enter optional data that is usually not displayed.  An example of this sort of behavior can be seen on  a web page at
http://www.ee.byu.edu/include/xml_templates_3_8/docs/web/common_tasks/sample_ex_coll_sections.phtml

I need this because I'm using Access to prototype the look & feel of a web app.
leslieinvaAsked:
Who is Participating?
 
Jeffrey CoachmanMIS LiasonCommented:
Here is a sample,

I only did the logic for the first section.

I am sure you can continue the coding sequence for the other scenarios.

;-)

JeffCoachman
Access-EEQ24166542ExpandCollapse.mdb
0
 
puppydogbuddyCommented:
try datasheet/sub-datasheet form views.  See this link:
               http://blogs.msdn.com/access/archive/2007/09/18/form-views-and-subdatasheets.aspx
0
 
Jeffrey CoachmanMIS LiasonCommented:
leslieinva,

You can also use the "InsdeHeight" property of the form.

Something like this:
    If InsideHeight = 2625 Then
        InsideHeight = 3725
    Else
        InsideHeight = 2625
    End If

The measurement is actually in "Twips"
1 inch =1440 twips
1 millimeter=56.7 twips

Here is a sample:

JeffCoachman
Access-EEQ-24166542ResizeFormAre.mdb
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
leslieinvaAuthor Commented:
boag2000,

I looked at the app you linked to, but it didn't do anything when I clicked it's Less & More buttons even after I told Access 2007 to enable the VBA content.  Any hints?


puppydogbuddy,

Datasheets won't work because I need to list labels down the left & values in the next column.
0
 
leslieinvaAuthor Commented:
boag2000,

Does the InsideHeight apply to the entire form?  What if I needed more than one expandable section in the same form?

Thanks
0
 
Jeffrey CoachmanMIS LiasonCommented:
"but it didn't do anything when I clicked it's Less & More buttons even after I told Access 2007 to enable the VBA content.  Any hints?"

First please put my sample in a "Trusted" location, to avoid the VBA question.
Then run it as-is without modification.
It works fine for me.
Let me know...

If not, just re-reate the form.
It's just a simple form you can make on you own, with less than 10 lines of code.


"Does the InsideHeight apply to the entire form? "
Yes.

"What if I needed more than one expandable section in the same form"
Forms can only be rectangular, they do not have "Sections".

The webpage you posted is a "WebPage".
A WebPage does not function in the same way as an Access form.

Although I believe the same effect can be achieved.

I'll work on this unless another Expert comes up with something more suitable..

JeffCoachman
0
 
leslieinvaAuthor Commented:
Hey Jeff,
I got your sample to work on a different PC, must be some Access setting I have set differently.
I know Access isn't a web page, but I was hoping I could simulate just for prototyping, using Access because I can have some dummy data in my prototopy using Access.
0
 
leslieinvaAuthor Commented:
Hey boag2000,

This looks like it will work.  I just haven't had time to test it with the rest of the code to control each section individually. I do it soon I hope.
0
 
Jeffrey CoachmanMIS LiasonCommented:
Take your time.
;-)
0
 
leslieinvaAuthor Commented:
I couldn't find the time to complete the code to really test it out.  Looks like it will work when I get around to it.  Wish the expert had the time to complete a full coded example.
0
 
Jeffrey CoachmanMIS LiasonCommented:
leslieinva,

    "Wish the expert had the time to complete a full coded example."

The whole idea behind this site is to provide you with "a" solution, not necessarily an exact "full coded example".
;-)

While many Experts will post solutions, most of these solutions will be "generic" in nature.
Many experts shy away from submitting "Finished Products" because it conflicts with what they normally charge a fee for.
Please remember that all Experts here are volunteers.
;-)

Again, as I stated, it is difficult to do what you are asking in Access forms without some fairly painstaking code logic.
This functionality is seen mostly in web pages (as you clearly demonstrated by posting a web page example link, not a database form example)
;-)

Finally, if you needed assistance, why didn't you just ask?

Here is an updated sample it goes a bit further than the previous sample.
It still has to be tweaked to adjust for expanding individual sections after a full collapse.
As you can see from all the extra I had to write, that again, this will require some work on your part.
You must take the code pattern I have outlined and extend it for all possible Expand/Collapse scenarios.

;-)

JeffCoachman
0
 
Jeffrey CoachmanMIS LiasonCommented:
1
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.