Solved

Form/subform can grow/shrink.

Posted on 2003-10-30
6
752 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
Comment Utility
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
Comment Utility
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 33

Expert Comment

by:Mike Eghtebas
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:avoorheis
Comment Utility
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 33

Accepted Solution

by:
Mike Eghtebas earned 350 total points
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now