?
Solved

Got it border to red and bold, but now need to restrict to certain ones.

Posted on 2011-10-13
4
Medium Priority
?
204 Views
Last Modified: 2012-06-27
I got borders to be red and bold, but did not realized, it is doing this for every due date.  I only need it on those due days that will be wihtin days 7 or less.  So, back to myoriginal issue of conditionally adding red/bold borders to these boxes.
Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)
'If Due date is with 7 or less days, make the box and data red

    If [TaskDueDate] < Date + 7 And (IsNull([TaskCompletionDate]) Or [TaskCompletionDate] = "") Then
         Me.lblTaskDueDate.BorderStyle = 1
         Me.lblTaskDueDate.BorderColor = RGB(239, 5, 29)
         Me.lblTaskDueDate.BorderWidth = 2
         Me.TaskDueDate.BorderStyle = 1
         Me.TaskDueDate.BorderColor = RGB(239, 5, 29)
         Me.TaskDueDate.BorderWidth = 2
    End If


End Sub

Open in new window

0
Comment
Question by:ssmith94015
  • 3
4 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 36965719
I don't think it is possible to do things exactly as you want.  The closest approximation I can think of is to mimic a border with a slightly larger textbox in the background, and conditionally format that.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 36966118
Wow!  I completely missed this one earlier.

The report needs to be opened in Print Preview or printed (Normal View).   Report View  won't work.

Apart from that, all you need to do is include an Else block for contrasting conditions, and your formatting will show up as expected:

Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)
'If Due date is with 7 or less days, make the box and data red

    If [TaskDueDate] < Date + 7 And (IsNull([TaskCompletionDate]) Or [TaskCompletionDate] = "") Then
         Me.lblTaskDueDate.BorderStyle = 1
         Me.lblTaskDueDate.BorderColor = RGB(239, 5, 29)
         Me.lblTaskDueDate.BorderWidth = 2
         Me.TaskDueDate.BorderStyle = 1
         Me.TaskDueDate.BorderColor = RGB(239, 5, 29)
         Me.TaskDueDate.BorderWidth = 2
    Else
         Me.lblTaskDueDate.BorderStyle = 0
         Me.lblTaskDueDate.BorderColor = 0
         Me.lblTaskDueDate.BorderWidth = 0
         Me.TaskDueDate.BorderStyle = 0
         Me.TaskDueDate.BorderColor = 0
         Me.TaskDueDate.BorderWidth = 0

End Sub 

Open in new window

0
 

Author Closing Comment

by:ssmith94015
ID: 36969850
EXCELLENT! Thank you

Sandra
0
 
LVL 61

Expert Comment

by:mbizup
ID: 36969865
Glad to help out :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A Case Study of using the Windows API to provide RS232 communications capability in Access without the use of Active-X controls.
A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

569 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