Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 23rd, 2007, 02:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 126
Thanks: 5
Thanked 0 Times in 0 Posts
Default Conditional Format of Sub-report

Hello!
I have the following code on a sub-report and isn't working correctly. Can anyone help? I need the Planned Completion Date field to show up in red shading and yellow text if the planned completion date is past and the Actual completion date is empty. Right now it tells me that an object is missing, but when I tried breaking this into a 'stepped' IF statement, then it evaluates and steps through the if statement correctly, but passes over the lines that I have to set the formatting. :(

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Me.[7-ActualCompletionDate] Is Null And Me.[6-PlannedCompletonDate] < Now() Then
    Me.[6-PlannedCompletonDate].BackColor = vbRed
    Me.[6-PlannedCompletonDate].ForeColor = vbYellow
Else
    Me.[6-PlannedCompletonDate].BackColor = vbWhite
    Me.[6-PlannedCompletonDate].ForeColor = vbBlack
End If

End Sub
Regards,
Laura

FYI...My user id has changed. My old id was lbreitenbach

The only thing standing between you and your goal is doubt. Quit doubting yourself and you'll be able to accomplish anything!
__________________
Regards,
Laura

The only thing standing between you and your goal is doubt. Quit doubting yourself and you'll be able to accomplish anything!
 
Old July 24th, 2007, 07:14 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Try this on the Detail section's On Format event:

Dim dtDate As Date
dtDate = Now()

If IsNull(Me.7-ActualCompletionDate) Or Me.7-ActualCompletionDate = "" And Me.6-PlannedCompletonDate < dtDate Then
    Me.6-PlannedCompletonDate.BackColor = vbRed
    Me.6-PlannedCompletonDate.ForeColor = vbYellow
Else
    Me.6-PlannedCompletonDate.BackColor = vbWhite
    Me.6-PlannedCompletonDate.ForeColor = vbBlack
End If

Did that help?

mmcdonal
 
Old July 24th, 2007, 09:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 126
Thanks: 5
Thanked 0 Times in 0 Posts
Default

Mmcdonal,
Thank you very much for your assistance...that works perfectly!

Regards,
Laura

FYI...My user id has changed. My old id was lbreitenbach

The only thing standing between you and your goal is doubt. Quit doubting yourself and you'll be able to accomplish anything!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting on report in Access bronen Access VBA 3 August 1st, 2008 07:33 AM
Report generation in PDF format kavithaatpass BOOK: Professional Crystal Reports for VS.NET 5 March 27th, 2006 07:10 PM
Conditional Hide Report Page Header SGL Access VBA 0 August 30th, 2004 02:36 PM
report printing in text format vineet@kanpur VB How-To 0 June 25th, 2004 11:32 AM
Landscape report format chinhow Crystal Reports 3 April 4th, 2004 10:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.