Link to home
Start Free TrialLog in
Avatar of smurfer69
smurfer69Flag for United States of America

asked on

hide associated text box when field is null in report

I have a report in access 2007, which lists catagories, some of the catagories have sub-catagories,  attached to the catagories are text boxes which are there simply to have a place to fill in on paper date acheived etc.  The items which have sub-catagories alos need these boxes but only when they are present, if I add the text boxes they show even when the sub is null and it makes the formatting a mess.  I need a way to somehow hide the text boxes when the value is null
Avatar of clarkscott
clarkscott
Flag of United States of America image

In design view, right-click on the left margin report section where the field resides (Header, Detail, etc.) and select the FORMAT propert.
In this code section.....

If isnull(me.YouField) then
    me.YourTextBox.visible = false
else
   me.YourTextBox.visbible = true
end if

Scott C
Avatar of smurfer69

ASKER

The code does not seem to run, I had initial forgotten the end if and no error
I have a question what stops the detail section from showing when ther is not data in the sub?
ASKER CERTIFIED SOLUTION
Avatar of ROM
ROM
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did you right-click on the Report Section - on the gray box in the left side margin- Detail, Header, Footer, etc?
Did you select Properties from the exposed menu?

Did you select ON FORMAT event and enter the code?

You can alway type STOP in the code (before any other code).  The app will break at that point and display the code (stop on the word "STOP")

If the app doesn't stop - then you've coded something that isn't part of 'the process'.

Scott C

Many thanks

Happy to help

R