Solved

Form/subform can grow/shrink.

Posted on 2003-10-30
6
753 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 33

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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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 33

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

920 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

15 Experts available now in Live!

Get 1:1 Help Now