Solved

Form/subform can grow/shrink.

Posted on 2003-10-30
6
755 Views
Last Modified: 2012-06-21
I'm trying to come up with a form that will display data from several tables. I'll just display one record from the main table, but there may be several records from supporting tables. I usually use sub-forms for this type of situation, but in this case, I want the support records to display fully, without scrolling.

So, this is easy to do in a report, but since can grow/shrink doesn't work with forms, I'm just wondering if there are alternatives to accomplish what I want.

I've played around with changing the subtforms .height and .top properties (based on # of records) and can probably make it work that way, it just seems like a very large amount of code to handle about 6 or 7 subforms and other contronls that come between and after the subforms.
0
Comment
Question by:avoorheis
6 Comments
 
LVL 32

Assisted Solution

by:jadedata
jadedata earned 100 total points
ID: 9652170
Hey avoorheis!

  Your simple answer here is to set the subforms to a size that is most comfortable for all views of the data.
  And to segregate the subforms in such a ways that other controls don't interfere with "lengthening" the subform.
  Perhaps a Tab control for the subforms would serve this purpose.
 
regards
Jack
0
 
LVL 39

Assisted Solution

by:stevbe
stevbe earned 50 total points
ID: 9653026
tabs would work good as jack suggests, you might also consider making the height of the subforms as large as the screen will hold ...

Me.childForm1.Height = Me.InsideHeight - (Me.childForm1.Top + me.Section(acFooter).Height)

Steve
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 9653151
Stack your subforms (all with 0 heigt) very closely in top of one another in detail section of your main form, like:
=================================================    sf1    continous
=================================================    sf2    continous
=================================================    2f3    continous


In the on openevent of you form include
Dim Qty1 As Integer, Qty2 As Integer, Qty3 As Integer
Qty1 =Dcount("*","Table_sf1","add your criteria here")
Qty2 =Dcount("*","Table_sf2","add your criteria here")
Qty3 =Dcount("*","Table_sf3","add your criteria here")
Me!sf1.Height=1.667*1440*Qty1     ' you may need to add a constant correction value to this
Me!sf2.Height=1.667*1440*Qty2     ' you need to experiment with it
Me!sf3.Height=1.667*1440*Qty3     ' 1.667" is defaul value.  I usually change it to .15"

Mike
0
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

Author Comment

by:avoorheis
ID: 9654841
Mike,

I tried your suggestion, but the first subform covers up the second subform. Are you saying that the subforms after the first one actually move lower on the form (depending on the height of subforms that come before them)?
0
 
LVL 34

Accepted Solution

by:
Mike Eghtebas earned 350 total points
ID: 9654881
Sorry about it, use:

Dim Qty1 As Integer, Qty2 As Integer, Qty3 As Integer
Qty1 =Dcount("*","Table_sf1","add your criteria here")
Qty2 =Dcount("*","Table_sf2","add your criteria here")
Qty3 =Dcount("*","Table_sf3","add your criteria here")
Me!sf1.Height=1.667*1440*Qty1  
 
Me!sf2.Top=Me!sf1.Top+Me!sf1.Height
Me!sf2.Height=1.667*1440*Qty2

Me!sf3.Top=Me!sf2.Top+Me!sf2.Height  
Me!sf3.Height=1.667*1440*Qty3    
0
 

Author Comment

by:avoorheis
ID: 9663698
thanks guys
I guess there really isn't some magical way to make a sub form act like a report, but your suggestions will help.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

790 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