Solved

Access Report - Make label invisible (if ..)

Posted on 2014-04-09
6
1,279 Views
Last Modified: 2014-04-12
Hi,

I have a database than monitors the fixing of cars.

I have a "job" form that has an BUTTON to print a single page "jobsheet".

The "CallOutCharge" prints on the jobsheet (using qryJobSheet)

However, if the "CallOutCharge" is zero then the report label called "label999" should NOT print (or be invisible).

How do I make "label999" NOT print.
0
Comment
Question by:Patrick O'Dea
  • 3
  • 3
6 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39990177
Add VBA to the Format event of the detail section (or whatever section the label is in):


Me.Label999.visible = (Me.CallOutCharge <> 0)

Open in new window

0
 
LVL 61

Expert Comment

by:mbizup
ID: 39990184
Alternatively, use a textbox for this instead of a label and use conditional formatting.

Select Expression Is from the drop-down and place this in the expression entry box:

[CallOutCharge] = 0

Open in new window


and set the text and background formatting to make the textbox blend in with the paper (eg: all white)
0
 

Author Comment

by:Patrick O'Dea
ID: 39990256
Thanks mbizup,

Option A worked well.

I note that when I change to "CallOutCharge" on the main form - The report prints the ORIGINAL (unchanged) value.

However, If I exit the form and re-enter and THEN print - All is well!

Why?
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

Author Comment

by:Patrick O'Dea
ID: 39990260
Sorry mbizup,

I had intended to put my last response (above) as a separate question.

Would this be a better way to go?
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39990370
No worries...

The reason that is happening is most likely that the data on your form has not been committed to the table yet, and (drum roll...) the report is reading data from the table not directly off the form.

To ensure that you have the updated data displaying in your report, force a save immediately before your OpenReport statement, like this:

Me.Refresh  ' Or docmd.runcommand accmdSaveRec
Docmd.OpenReport ... etc..

Open in new window

.

Take a look at this article, for this and similar issues:
http://www.experts-exchange.com/Database/MS_Access/A_10162-What-is-in-a-field-Value-vs-Text-and-the-differences-between-form-data-and-table-data.html
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 39996626
Great, that's fixed it!
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question