Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / February 2008

Tip: Looking for answers? Try searching our database.

Visible Property

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Harvard - 29 Feb 2008 16:19 GMT
I have a report that has a "project" field.  Sometimes the project field has
data in it, and sometimes it doesn't.  I also have a running sum that counts
the number of projects.  I want the running sum to be hidden when there is no
project corresponding to it.  Currently, when no project is displayed, the
running sum is still set to "1."  

This is what I've got so far...let me know if my logic is wrong...

=IIf([Project]<>"",[ProjectCounter].[Visible]=Yes,[ProjectCounter].[Visible]=No)

Thanks
Marshall Barton - 29 Feb 2008 17:39 GMT
>I have a report that has a "project" field.  Sometimes the project field has
>data in it, and sometimes it doesn't.  I also have a running sum that counts
[quoted text clipped - 5 lines]
>
>=IIf([Project]<>"",[ProjectCounter].[Visible]=Yes,[ProjectCounter].[Visible]=No)

Setting property values is not something you can do in an
expression.  You need to use VBA code to do it.

Put this kind of code in the Format event procedure of the
section that contains the text box:

Me.ProjectCounter.Visible = (Me.Project <> "")

Signature

Marsh
MVP [MS Access]

Harvard - 29 Feb 2008 18:28 GMT
Maybe I did something wrong, but that didn't work.  I'm using Access 2007.  I
right-clicked "projectcounter" and then clicked "build event."  from there, I
selected Code Builder.  Then  pasted the code that you told me to put...saved
it, and refreshed the report, but nothing happened.  Did I do something wrong?

> >I have a report that has a "project" field.  Sometimes the project field has
> >data in it, and sometimes it doesn't.  I also have a running sum that counts
[quoted text clipped - 13 lines]
>
> Me.ProjectCounter.Visible = (Me.Project <> "")
Marshall Barton - 29 Feb 2008 20:08 GMT
The Format event must be for the **section** containing the
text box.  In my opinion, the event builder often guesses
worng about what event you want to create so you can easily
mess things up using that feature.  Better to click in a
nlank are of the section near the text box and then find the
Format event **property**.  Select [Event Procedure] from
the drop list and the use the [...] button to get to the
event **procedure** where you can enter the code.

If perchance all that is what you have, then you need to
investigate the code to make sure it is really doing what
you need it to do.  For instance, you check if Project is
not "", are you sure the is not Null instead?  Maybe you
should be using:

    Me.ProjectCounter.Visible = Not IsNull(Me.Project)

or in unusual situations where it could be either "" or
Null:
   
    Me.ProjectCounter.Visible = (Nz(Me.Project, "") <> "")
Signature

Marsh
MVP [MS Access]

>Maybe I did something wrong, but that didn't work.  I'm using Access 2007.  I
>right-clicked "projectcounter" and then clicked "build event."  from there, I
[quoted text clipped - 18 lines]
>>
>> Me.ProjectCounter.Visible = (Me.Project <> "")
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.