Expandable/collapsible levels in form view (1 Viewer)

JamesMcS

Keyboard-Chair Interface
Local time
Today, 22:09
Joined
Sep 7, 2009
Messages
1,819
Bonjour all, hope you're having a fun day....

An idea popped into my head, and I wondered if it was doable - is it possible to make a form expand into sublevels when in form view? I've seen it before in a table's datasheet view, but can it be done in form view?

What I'm trying to do is this - I've got a subform in continuous view, showing performance for manufacturers. What I'd like to do is be able to show the figures for vendors (one manufacturer, many vendors) by clicking a + button next to the manufacturer.

My first guess would be a command button that increases the height of the form (but then how would you do that just for the selected record?) to reveal another subform with the vendor numbers therein, but am I reinventing the wheel?

Thanks in advance all,
 

DCrake

Remembered
Local time
Today, 22:09
Joined
Jun 8, 2005
Messages
8,632
You may be better off looking at tree view controls where you can expand and collapse node levels
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 22:09
Joined
Sep 7, 2009
Messages
1,819
Didn't think of that... nice one, will look into it when the time comes!
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 22:09
Joined
Sep 7, 2009
Messages
1,819
OK, so I've had a look at treeviews and I don't think they're exactly what I'm after. Is there any way just to increase the height of one record in a form in continuous view?

I read something somewhere once about having alternating colours in a continuous form, which involved acting on one record at a time. I might have a google and see if I can adapt that somehow...
 

DCrake

Remembered
Local time
Today, 22:09
Joined
Jun 8, 2005
Messages
8,632
Alternate colours are no problem, however as the subform is basically only one set of controls that is repeated continuously, as the name suggests, its a case of all for one and one for all in respect to certain events or formatting, such as control height.
 

CBrighton

Surfing while working...
Local time
Today, 22:09
Joined
Nov 9, 2010
Messages
1,012
It'll be a two part job.

First you will need to work out how to identify whether the record should be expanded. This is what step 1-3 do in this case.

Step 4 is the code to actually make a change based on that criteria.

Do you have a way that the form can easily identify records which you want a taller section for?

:edit:

It's worth noting that I spent a day or two trying to get a similar things to work on a report... and failed. DCrake is likely right. in a report I found that heights can vary across pages, but on each page the sections had the same height.
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 22:09
Joined
Sep 7, 2009
Messages
1,819
Yeah I was worried it might be the case, DC's siggestion of a treeview sound like the way to go but I've had no experience with it... no time like the present to learn I guess!

What I wanted was a little "+" command button to show more detail for a particular manufacturer or product group.

I didn't realise in that link that the colour of the row was actually a text box, I thought it was the background colour of the form that was changing - so it's not a property of the form itself, just a control... oh well
 

CBrighton

Surfing while working...
Local time
Today, 22:09
Joined
Nov 9, 2010
Messages
1,012
I have used a treeview in my staff database for a telephone cascade. In my case the plus takes me to the person they contact, which would then have a plus to take me further down the cascade.

However, my treeview is populated by a VBA module, so logically that module could be edited to open two recordsets, one for the products and one for additional info.


I had zero experience of treeviews, I used these 3 links to build my first one so they may help you:

http://www.developerfusion.com/article/77/treeview-control/2/
http://www.databasejournal.com/feat...p/3734331/Access-TreeView-ListView-Basics.htm
http://mymsaccessblog.blogspot.com/2008/03/my-treeview-project.html
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 22:09
Joined
Sep 7, 2009
Messages
1,819
Thanks CBrighton, I'll have a look at those today. Just a quick one though for you both - could I have a subform that changes source object, links etc. absed upon what the user has clicked on in the tree?
 

CBrighton

Surfing while working...
Local time
Today, 22:09
Joined
Nov 9, 2010
Messages
1,012
Yes.

There is a node click event which fires when the text of a node is clicked on (not the +), in my cascade form I use this to populate a subform with contact details, next of kin details, etc.
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 22:09
Joined
Sep 7, 2009
Messages
1,819
Wicked, that sounds like the way to go then. Thanks to you both for the info!
 

Users who are viewing this thread

Top Bottom