Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2009-02-22
12
Medium Priority
?
2,616 Views
Last Modified: 2013-11-28
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.
0
Comment
Question by:leslieinva
  • 6
  • 5
12 Comments
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 23706807
try datasheet/sub-datasheet form views.  See this link:
               http://blogs.msdn.com/access/archive/2007/09/18/form-views-and-subdatasheets.aspx
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 23708361
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
 

Author Comment

by:leslieinva
ID: 23710793
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:leslieinva
ID: 23710825
boag2000,

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

Thanks
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 23711920
"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
 

Author Comment

by:leslieinva
ID: 23712001
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
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 1500 total points
ID: 23712264
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
 

Author Comment

by:leslieinva
ID: 23777919
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 23779829
Take your time.
;-)
0
 

Author Closing Comment

by:leslieinva
ID: 31549825
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24173842
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
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24173848
1

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

580 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