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 September 4th, 2006, 04:17 PM
Registered User
 
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default hiding empty text boxes in an Access report

Is there any way to stop Access 2000 displaying an empty text box in a report? I've got a report that needs the potential to list 20 different fields of data, but I only want them (the text boxes) displayed if the fields are 'not null'. Any ideas welcome (even delving into VB, though it'll have to be in kiddie language!).

TIA

I drink, therefore I am.
 
Old September 5th, 2006, 06:58 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

In the Detail section of the report, in the On Format event, do this:

If IsNull(Me.FieldName) Or Me.FieldName = "" Then
   Me.FieldName.Visible = False
   Else
   Me.FieldName.Visible = True
End If

You will need to do this for each field.

Alternatively, you can set the Can Grow and Can Shink properties to yes on each control. I think they will shrink down to 0 twips if they are empty.

Does this help?


mmcdonal
 
Old September 5th, 2006, 11:53 AM
Registered User
 
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'll give both of them a go and see what happens. Thanks mate!

I drink, therefore I am.
 
Old September 6th, 2006, 04:01 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

For checkboxes, if triple state is set to NO, the checkbox will never be null. It is always TRUE or FALSE. For that case, you simply set its visible property this way

Me.chkMyCheckBox.Visible = Me.chkMyCheckBox

If the checkbox is TRUE, Me.chkMyCheckBox is TRUE, and the visible property is set to TRUE. If false, the checkbox will disappear. Use your real checkbox name(s).



Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old September 7th, 2006, 11:43 AM
Registered User
 
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried the 'can grow' and 'can shrink' option and they worked a treat. I'll give the code battering a go when I get a chance. Thanks guys!

I drink, therefore I am.





Similar Threads
Thread Thread Starter Forum Replies Last Post
crytal report text boxes badamsreekar Crystal Reports 0 June 15th, 2007 12:20 AM
Access VBA - Controlling Text boxes in a form Scripts82 Access VBA 4 February 8th, 2006 08:35 PM
Access to the path "E:\WebSites\Report\text.txt" favaedi BOOK: ASP.NET Website Programming Problem-Design-Solution 1 November 21st, 2004 11:36 AM
Populate Access 2000 report text from form BradLee31 Access 1 September 16th, 2004 09:05 PM
Hiding text keystrokes for passwords mmcdonal Access VBA 4 March 16th, 2004 04:18 PM





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