Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 13th, 2007, 02:46 AM
Registered User
 
Join Date: Aug 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Continous Form, resize based on content (Tricky)

Ok here's one I haven't been able to find any documentation on.

I have several continuous form, subforms with large "Memo" based textboxes in them. However, some entries are very long (6-10 lines) and others are only a line or two. Visually it looks really ugly and is hard to scroll through so I'm look for a way to resize the height of each txtbox and the Detail section it is in based on the number of characters in the text box... Any ideas?

~HK
 
Old August 13th, 2007, 11:52 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Look up Form.InsideHeight, which sets the inside height of the form in twips (1400 twips per inch). I don't usually do this but that might help. You would do something like:

-Count the number of characters in the text box string.
-Figure out a formula for the number of twips based on the number of characters (get a sense for how many characters per line on average)
-Set the Form.InsideHeight based on the twips count.

Maybe like:

Dim sString As String
Dim iCount As Integer
Dim iTwips As Integer

sString = Me.TextBox 'check for nulls
iCount = Len(sString)

iTwips = ((iCount / 60) * 720) '1/2 inch of form height, for example, for each line of 60 characters

Form.InsideHeight = iTwips

I am not sure how this would work with a continuous form, though.

Did that help?






mmcdonal
 
Old August 13th, 2007, 12:02 PM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts
Default

My experience with continuous forms, is that aside from data, every element of the form is duplicated for all records in the form. Hence any change to size, color, graphics or anything like that, that is data dependent will be the same.

It's pretty frustrating, and I would love to proved wrong... The closest solution I have found is allowing text boxes within the form to be scrollable.

This is one of the few area's where Access just isn't as flexible as a Web App or other programming languages.

Mike



Mike
EchoVue.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Tricky : Don't want to load MDI form first navdeep C# 2005 7 May 6th, 2008 01:51 AM
Resize form [email protected] C# 1 December 7th, 2007 03:53 AM
Is it possible to select record in continous form chiefouko Access VBA 0 July 18th, 2006 04:20 AM
Continous form problem Vince_421 Access VBA 10 June 1st, 2006 05:06 AM
Resize Form quocanh General .NET 1 October 12th, 2004 12:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.