Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Font Bold If it is a Holiday 1

Status
Not open for further replies.

ZmrAbdulla

Technical User
Apr 22, 2003
4,364
AE
Hi,
I have a database calculating Overtime work of the employees. It generates a report total working hours with day by day details.
Is that possible to have the record to be bold Font if it is a Holiday.
Conditional Formating is the way. But how can I tell the Report to look for a condition?

Thanks

Zameer Abdulla

 
You can use the Print Event of the detail section which is called for each Row to format your fields

Best of luck
 
Do you have a table of holidays? If you look at the records the report is based on, how would you know if a record was a holiday or not?

Conditional formatting is one method and code in the On Format event of the section containing the controls is the other. However, if you don't have a table of holidays or some other indication then you can't accomplish this short of running the report and getting out your hi-liter marker.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Hi Duane,
I don't have a table of Holidays. Can you give an idea of connecting table of holidays and the report.

Conditional formatting I mean I can have a checkbox for each record and make it true if it is a holiday and react as per the checkbox. It is prcactical but not siutable for large number of employees. There would be a chance of mistake.

Thanks

Zameer Abdulla

 
Start by making a table of holidays with the date and holiday name. You can then join it to your reports recordsource with a join that selects all records from your original query and the holiday table where it matches.

You can then add the HolidayName to the grid. Conditional formatting can check if the HolidayName is not null to determine if it should be bolded or not.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
No, I won't take the time to create and send you a sample. Have you created a table of holidays as I have suggested?
After you have done so, come back with table and field names from your report's record source.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Hi Duane,
I have created a Holidays table contains the following fields
HolidayID = Text
Date = Date/Time [This is the Primary Key].

And the following is the SQL of the Query for the Report

SELECT Employees.EmployeeName, Employees.Designation, Employees.Department, OTList.Date, OTList.StartTime, OTList.EndTime, OTList.FoodAllowance, OTList.Discription, DateDiff("n",[StartTime],[EndTime]) AS Calculation1, Int([Calculation1]/60) & ":" & Int([Calculation1] Mod 60) AS TotalHours, DateDiff("n",[StartTime],[EndTime])/60 AS Hours
FROM Employees INNER JOIN OTList ON Employees.EmployeeID = OTList.EmployeeID
WHERE (((Employees.EmployeeName)=[Forms]![StaffDetails]![Combo24]) AND ((OTList.Date) Between [Forms]![StaffDetails]![FirstDate] And [Forms]![StaffDetails]![SecondDate]));

Please help me to go forward.
Thanks for sharing your time.


Zameer Abdulla

 
Change the name of the date field from date (which is the name of a function) to something like HoliDate. Then add the new table to your query and join the HoliDate field to your other field named "Date". Double-click the join line and select the option to select all records from OTList.

Then, add HolidayID to the grid. In the report, you can add the HolidayID to a text box in the report. In the code of the On Format event, add lines like:
If IsNull(Me.txtHolidayID) Then
Me.txtSomeField.FontBold = False
Else
Me.txtSomeField.FontBold = Tre
End If
You could also use conditional formatting.


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top