Solved

Access Report - Make label invisible (if ..)

Posted on 2014-04-09
6
1,268 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:Patrick O'Dea
Comment Utility
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
Comment Utility
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
Comment Utility
Great, that's fixed it!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now