How to squeeze out vertical space when controls have no value?

MSAccess 2003
My simple form has several fields arranged vertically in the detail section. 
 Some of the fields may have null or zero-length string values.
I have the Can Shrink property of each control set to "Yes".
In the code for the Detail_Format event, I have the following type of logic, 
replicated for each control:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Me.Controls("Description").Visible = True

If Me.Controls("Background").Text = "" Then
    Me.Controls("Background").Visible = False
End If

'Same thing for next control....
'Same thing for next control....

End Sub

In the debugger I can see that the Visible property is set to Flase when the 
text value of the control is "".

WHAT I DO NOT GET IS why the print preview still shows vertical space where 
there is a shrinkable invisible control.

Thanks in advance.  -CCW
0
Utf
12/10/2007 8:24:01 AM
access.forms 6864 articles. 2 followers. Follow

2 Replies
988 Views

Similar Articles

[PageSpeed] 14

I would suggest that you create a report.

You simply set a text box 'can shrink" property to yes, and if it has no 
value, then data is moved up.

YOU DO NOT need code to solve this problem.

I never tried this when printing a form, but I NEVER try to print forms, I 
create a report with the information and use that.

So, as a suggestion do try and built a report.

So, try the setting the can shrink property to yes. Also, make sure contorls 
don't overlap, else this will not work.

-- 
Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com


0
Albert
12/10/2007 8:54:48 AM
Albert,  Thanks for the speedy reply.
It is in fact a Report and not a Form - my mistake.

Textboxes are still set to be visible, shrinkable, growable.  Code was 
removed.
Textboxes do not overlap.

On Print Preview, now (same test data) the textbox LABELS appear for those 
rows that the code previously detected as <control>.Text = "" and nothing is 
visible in the data part of the textbox for those rows.

Could this result from the actual data value being a non-printable like 
linefeed or carriage return only?

Puzzled,
-CCW


"Albert D. Kallal" wrote:

> I would suggest that you create a report.
> 
> You simply set a text box 'can shrink" property to yes, and if it has no 
> value, then data is moved up.
> 
> YOU DO NOT need code to solve this problem.
> 
> I never tried this when printing a form, but I NEVER try to print forms, I 
> create a report with the information and use that.
> 
> So, as a suggestion do try and built a report.
> 
> So, try the setting the can shrink property to yes. Also, make sure contorls 
> don't overlap, else this will not work.
> 
> -- 
> Albert D. Kallal    (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOOSpamKallal@msn.com
> 
> 
> 
0
Utf
12/10/2007 4:07:02 PM
Reply:

Similar Artilces:

Quest: Creating a panel of controls in an ActiveX control... #4
I want to make a panel with some Windows Controls on it using ActiveX w/ full MFC or ATL support. I been looking thur app templete all day and cant find a start project for this. Now I know how a standard modeless dialog with its titlebar and border styles turned off make to the panel but I am having trouble creating the actual ActiveX project that host the panel. How do I create the project and use it in another like an MFC exe dlg app... I am using VS.Net Pro 2002 so what is the best way to get started here... Any help... ...

Data from Edit control 2 a file
I would like to know how to write data obtained from Edit boxes into a simple text file?? CStdioFile will let you write the text to a file. You can get the contents of the control using GetWindowText. I think you asked the same question couple of days ago. Search this newsgroup/google for responses. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "CodeMan" <anonymous@discussions.microsoft.com> wrote in message news:F0E792AE-6C60-4643-83D2-BD6D7CFC70CF@microsoft.com... | I would like to know how to write data obtained from Edit boxes into a simple text file??? | Hello //...

Vertical Gridlines & Data Marker
Firstly, I noticed that a vertical gridlines of the chart are not align with the gridlines of the data tables. I am wondering how it can be aligned. Secondly, I also noticed that a marker is located on the leftside virtical gridlines of X scales. I am also wondering how to place it on the center. Hi Gary, In my version of Excel they are. Try it with a line chart. In Excel 2007 you might have to make an adjustment. We need more info. With a data table the markers are placed between the vertical gridlines, if you don't like that you can remove the data table and then format th...

Remove Space within a String
I have a Patient Name Field and the names are formated like this: ROCHA, TAMI There is a Space after the Comma that seperates the First and Last Name how can I remove this space? It should look like this: ROCHA,TAMI -- Brian Conner Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200912/1 REPLACE (Patient_Name, ', ' , ',') Use it in a select for display purposes or in an update to change the data stored in the column. RLF "Brian Conner via SQLMonster.com" <u47161@uwe> wrote in message ...

Word 2008: Last line disappears on page. When printed, squeezed against footer
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I have a simple 'Test.doc' 2-page file to illustrate the problem at <<a href="http://homepage.mac.com/geomarkle/filechute/Test.zip">http://homepage.mac.com/geomarkle/filechute/Test.zip</a>> <br> Keep the edit window short so you can scroll backward to make the last line scroll off the screen. When you scroll back you should see the last line has disappeared. <br><br>The file works fine under Word-2004 but under Word-2008 the last line disappears. You can get...

Setting Error #VALUE,#REF,#NAME, etc.
I am working on a work book that I want to use as a template. How do I hide all of the errors for the formulas in the cells that appear before the data is entered to make the formula function. What would be the best approach? "Gulfman100" <Gulfman100@discussions.microsoft.com> wrote in message news:F893F2B5-13AF-4AE0-AB48-92DB4571A39E@microsoft.com... >I am working on a work book that I want to use as a template. How do I hide > all of the errors for the formulas in the cells that appear before the > data > is entered to make the formula function. What would be...

Vertical Subtotals
Hello, I hope I am posting to the correct group. I have received a spreadsheet from someone that has subtotals in it (Data, Subtotals), but instead of the subtotals (the 1,2,3 in the top left corner) being horizontal they are vertical. Does anyone know how this is done? Could it be done through VBA? I have searched the internet as well as a number of books on Excel and can't seem to find this mentioned anywhere. Defintely has me intrigued. Thank you very much for any help, Michelle Data|Group It's not automatic like Data|subtotals, so they could have done lots of work. Gemma wr...

Linking dats on a worksheet to control panel
I am in the process of creating a gantt chart in Excel 2007 for various projects my company performing. I have created formulas so that the current date used to calculate the number of days remaining and the number of days past. I was wondering if there was anyway to link the current date to the control panel so it automatically updates everyday? This way I do not have to manually do it. Thanks to everyone that helps ...

Active X control in Excel 2003
I have is=nstalled a pen pad on my pc which usies an active x control in Excel to enable me to draw in it. Everytime I start Excel it asks me if I was to run this Active X control. Is there a way of stopping it asking me every time? Thanks Shane Excel 2003, Windows XP home Hi, I think if you lowered your security level, it wouldn't ask, but I wouldn't recommend doing so. It prevents unauthorized and possibly dangerous macros from running and causing damage. I'd put up with the nuisance. jeff >-----Original Message----- >I have is=nstalled a pen pad on my pc which usi...

XPath get the max value
can we get the max value of element from xpath e.g: Xpath Query Expression: /Books/Book[@id='3'] to select XMLNode which id is "3" Can I use Xpath to get the MAX Book id? Thanks in advanced. beachboy wrote: > can we get the max value of element from xpath > > e.g: Xpath Query Expression: /Books/Book[@id='3'] to select XMLNode which id > is "3" > > Can I use Xpath to get the MAX Book id? This XPath expression /Books/Book[not(@id <= preceding-sibling::Book/@id) and not(@id <= following-sibling::Book/@id)] selects the B...

space between y axis and data points..
I have a line graph with markers, and am plotting 7 pre-post (x axis) lines on a y axis of 1 to 100. By default, the "pre" points were plotted right on the y axis and the post points were all the way at the right end of the plot area. I checked "Value (y) axis crosses between categories", and this moves the pre (and post) towards the middle of the plot area, so that the points are now plotted to the right of the y axis. My question is, can I adjust the space between the y axis and where the "pre" data points are plotted? As they are now, there is too much of a g...

add vertical line to floating bar chart, still trying
still no luck trying to follow http://peltiertech.com/Excel/Charts/AddLineVertSeries.html when i create and paste special the new series, the one that should end up as the vertical line, there is no new plot on my chart that is available to be selected to specify that it be a say a xy scatter chart, and then after that go ahead and work the secondary axis adjustments etc. i have 2 series currently on the chart, each one creates 2 floating bars and the x axis values are set by a macro so that the bars are floating in a relevant price range, eg if the longest bar is say 50-60 the x axis ranges f...

HELP: Unable to clear values for control of type text in a userfor
Hi All, I have textboxes and comboboxes located in Frame1 and I only want to clear values in Textboxes when a user changes Student_Id field Here is my code so far: Private Sub StudentId_Change() For Each ctl In Me.Frame1.Controls If TypeOf ctl Is TextBox Then ctl.Value = "" End If Next End Sub For some reason the values in textboxes are not cleared, I inserted break points and found out that the control type of Textbox is not identified and hence passes the If statement directly to End if Thanks in advance Hi Try MSForms.Textbo...

Forms not showing vertical scroll bars
Hi all, I can't see what's causing this. I have a subform which is fine when I open it up on its own (datasheet view) - both scroll bars are showing. When I put it on a main form and open up the main form with the sub form embedded, the vertical scroll bar won't display in the subform. Anyone come across this and know the reason? Cheers Paul Hi Paul, I am assuming you have the subform set up as a datasheet view correct? If so, depending on how far you have the form stretched (opened) in the main form you won't see the vertical scroll bar until you place enough r...

How to add a Extra Control in a CommonDialog Control
Hi, I want to add a Extra Control like (Combobox, TextBox and Label) in a CommonDialog Control . Regards Senthil one question would be sufficient. see below ;-) from MSDN: To customize the dialog box, derive a class from CFileDialog, provide a custom dialog template, and add a message map to process the notification messages from the extended controls. Any unprocessed messages should be passed to the base class. Search around and I'm sure you'll find more details. "Guido Franzke" <guidof2000@yahoo.de> wrote in message news:uDv5LwQKEHA.3944@tk2msftngp13.phx....

Making a drop down control to choose a data series
Hi charting folks. I have a chart that has six data series plotted onto it. There are two sets of three "tests" that get their data plotted One in the morning and one in the evening. Right now, the chart is a bit cluttered with all six plots on it. They are, however, useful for an overall view. What I would like to do is create a drop down control that has three selections. Morning, Evening, and All. The All is obvious, and the Morning would select three columns of data, and the evening would select the other three. If I were to name the two sets of data using a ...

Lookup value selection
Is there any way to select lookup value by pressing "Enter" key on keyboard and avoid mouse click? -- romeo!! Please clarify. I could use the up and down arrow to select the values and then press "Enter" key to select the lookup value - works for me in v4.0. Frank Lee, Microsoft Dynamics CRM MVP http://www.workopia.com/Links.htm http://microsoft-crm.spaces.live.com "romeo" wrote: > Is there any way to select lookup value by pressing "Enter" key on keyboard > and avoid mouse click? > > -- > romeo!! ...

Column Chart with multiple vertical axis
I tried building a chart that displays 1 series in dollar sales and 1 series in unit sales. I tried putting one on a secondary axis, but it always overlaps the columns and changing the series overlap setting doesn't seem to have any effect? Does any one know what is going on and how I can separate columns on separate axis? Thanks, Jamie You need to add a couple dummy series to help align the visible series: http://peltiertech.com/Excel/Charts/ColumnsOnTwoAxes.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://...

Problem with controls overlapping a child window
Hi I have a CDialog window with some controls, I have another CDialog (with with WS_CHILD attribute). When I show the child window (embedded in the parent), the parents controls that should be hidden beneath the child window are still shown. I have tried setting "Clip Children" and "Clip Siblings" as well as "Control" attributes (in the resource editor for the dialog templates) but I can't seem to get it rigth. Calling SetWindowPos with CWnd::wndTopMost on the child window doesn't work either. I could ofcourse just hide all the controls in the parent wi...

copying values/text, not formulas
Heya ... I've got a workbook that consists of a "main page" with several columns of formatted text, and several columns of VLOOKUP'ed text drawn from several other worksheets in the workbook. My boss wants only the main page and not the others (too much space on his HD) ... I've been trying to use "Paste Special" to do this, first copying the formats over to a new page (looks exactly like what I have on the main page) and then copying the values. It works fine as long as I have only single cells selected. What goes wrong is when I have merged cells selected...

Random words are squeezed together when printed
Using Word 2002, when I print out a doc, a few random words are squeezed together when printed out, although they look fine on my screen before printing. This problem popped up when I bought a new computer that had an Office 2007 trial version on it. I have removed the trial version and restarted my computer but the problem still exists. Any help is appreciated as these are legal docs and every word must be legible. In addition to restarting your computer, have you also deleted any left-over temporary files (see the relevant portions of the article at http://www.gmayor.com/wh...

Controlling a category in a report
I have been using M2006 for a year and an bit and have the following question. I want to be able to control the inclusion or exclusion of a category in a report from the category itself. I realize I can customize a report, but if I have a category that I do not want in any reports it would be easier to just exclude it. Meaning it would be excluded from all reports unless I specifically customized a report to include it. Ying and yang so to speak. Basically, I want to control the reporting characteristics of the category from within the category and not from within the report. Sounds lik...

How do I change spacing between stackable bar graphs?
Trying to group stackable bars by threes in a six bar graph. Is it possible to make space between first group tighter and a larger space in between before the next tight group of three? ...

Add vertical lines on mirrored margins in word 2007
I am creating a user manual. I have set mirrored margins 1 1/2" from the edge with a small gutter margin. I set the margins as big as I did to allow an area to put text boxes with special tips or for just an area for people to write notes. I would like to have a vertical line separating the text from the blank margin area. If I draw a vertical line and anchor it, the line moves when edits or additional items are added to the text. Is there a way to insert a vertical line that will not move when the text is edited or section/page breaks are added? Please Help! THANK YOU!!! ...

PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ???
Hello , I am a university student and I have drawn a graph of some curves and it is about 2 pages wide . The university wants me to embed it in Word and send the Word document to them electronically . My problem is how can I embed it so that when the university prints out my project it fits to one page only so that it can be read easily? Can anyone help ? Thanks . Peter On Wed, 10 Sep 2008 17:13:50 +1000, someone@somewhere.com wrote: >Hello , > >I am a university student and I have drawn a graph of some curves and >it is about 2 pages wide . The university wants me to e...