473,394 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Access Report - Conditional Field Visibility

2
I am working with a basic access form for a payroll system and need to modify it such that if an employee worked overtime, then their overtime payrate and hours show up on the report below their regular payrate and hours.

Ex:
40.00 hours @ $77.00/hr
5.00 hours @ $102.00/hr

If an employee's overtime hours = 0, then the overtime payrate and hours fields should not be visible on the report.

Ex: 40.00 hours @ $77.00/hr

NOT:
40.00 hours @ $77.00/hr
0.00 hours @ $102.00/hr

Secondly, if the employee's overtime payrate is the same as their regular payrate, then their total hours and the single payrate should be visible.

Ex: 45.00 hours @ $77.00/hr

I have come close to this outcome using conditional formatting on the fields, telling the text to print as white if the field should not be visible. However, the formatting of the report is very important and I have two fields that need to be in the same position, only one being visible depending on if the overtime rate regular payrate are equal.

Ex: I either need to see...

40.00 hours @ $77.00/hr OR 45.00 hours @ $77.00/hr
5.00 hours @ $102.00/hr

...in the same starting position on the report. If one field prints in black and the other prints on top of it in white the result is a very light gray. (Not good for invoicing clients!)

Is there anyway to have one field simply not print (in white or any other color) if it does not belong on the report? Can I use an if/else statement somewhere in the field properties to accomplish this?
Mar 23 '07 #1
3 10439
nico5038
3,080 Expert 2GB
You can change your report query to deliver the hours in separate records like:

select "Regular"as Type, IIF(hours>40,40,hours) as RegularHours from tblYours
UNION
select "Overtime" as Type, hours-40 as Overtime from tblYours where hours > 40;

This UNION query will give one record for 40 hours or less and two for > 40 hours.

You'll have to add ofcourse the additional fields (like the rate), but i guess you get the idea.

Nic;o)
Mar 24 '07 #2
smuir
2
Thank you for your reply - the query already does all the hours seperation and calculations. I'm concerned with the report formatting only. Can I use the IFF function on a report field? I can't seem to get it to work. I need something like this in one field so that the report will print in an acceptable format to present to clients:

iff(RegPay <> OTPay, RegHrs, RegHrs+OTHrs)

After that I simply have the overtime hours set not to show up if the payrates are the same (RegPay = OTPay) or if OTHrs = 0.


You can change your report query to deliver the hours in separate records like:

select "Regular"as Type, IIF(hours>40,40,hours) as RegularHours from tblYours
UNION
select "Overtime" as Type, hours-40 as Overtime from tblYours where hours > 40;

This UNION query will give one record for 40 hours or less and two for > 40 hours.

You'll have to add ofcourse the additional fields (like the rate), but i guess you get the idea.

Nic;o)
Mar 26 '07 #3
nico5038
3,080 Expert 2GB
You can use in a textbox on the report:

=IIF(condition, True, False)

But you can also add the condition in the report query to create a new field like:

select IIF(condition, True, False) as TotalHours, ....

Now TotalHours can be placed on the report as a "normal" field.

Nic;o)
Mar 26 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Shiz | last post by:
I currently have a Form with Option buttons (to give you the option of sorting by name, or by Field, etc), these are referenced in a module which then formats the report contingent on the option...
3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
2
by: Bill Prew | last post by:
In an Access report, where there is a total line using the SUM() function against a field in the detail rows, is there a way to suppress the "#Error" that Access displays in that calculated field...
3
by: Dom | last post by:
Hi, I have a werid problem with a subreport. If someone can help me out I'd be very grateful! Based on results from a query, the visibility of textboxes and labels in a subreport are set to...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
5
by: Andrew Chanter | last post by:
Does anyone know a way you can use conditional formatting to create a banded style view as is commonly seen on the internet. (In othe words the first record appears on a gray background, the 2nd...
7
by: olseni | last post by:
Hi all I hope someone can help me with this. I am sure there is a solution, but I cannot seem to find it.... I need to make a report with the following format: In the columns I have 5 samples,...
3
by: summerlw | last post by:
Access 2003 VB 6.5 I'm attempted to run conditional formatting on a date field based on the value in another field. I've steped through this code and it is recognizing the values correct and is...
4
by: riaane | last post by:
Please help: I have Conditional Formatting on a Report Field that fills the background Red if the criteria is met. This displays correctly in Report View, however, when I "OutputTo" this report to...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.