ProgrammingMSAccess.com

Learn about Developers Group
Join Developers Group
Order SPAM Blocker
Free Stuff
Guest Book
.NET Resources
SQL Server Resources
Favorites
Technical Support
Books & DVDs by Webmaster
Articles, tutorials, & more
FAQs
Product Reviews
Samples
Prior Newsletters
Contact Us
Home
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The VBA code on the left controls the formatting for the access form on the right.  The private library for our database Developers group includes this sample in an .MDB file along with scores of files, including more code samples, white papers, book excerpts, and seminar slide decks.

 

Private Sub cmdAddFormat_Click()
Dim fcd1 As FormatCondition

If Me.OrderDate.FormatConditions.Count > 0 Then
MsgBox "Conditional format already exists."
Exit Sub
End If

Set fcd1 = _
Me.OrderDate.FormatConditions.Add( _
acExpression, _
acLessThanOrEqual, _
"Day([OrderDate])<=7")

Me.OrderDate.FormatConditions(0). _
ForeColor = RGB(255, 0, 0)
Me.OrderDate.FormatConditions(0). _
FontBold = True

End Sub

Private Sub cmdDropFormat_Click()

If Me.OrderDate.FormatConditions.Count _
> 0 Then
Me.OrderDate.FormatConditions(0).Delete
End If

 



 

Want to understand  Microsoft Access 2000/2002/2003 so that you can program it to do more tasks like this?  Get Programming Microsoft Office Access 2003 by Rick Dobson from Microsoft Press.  Learn more about the book by clicking here.

Copyright 2003 CAB, Inc. All rights reserved. Republication or redistribution of CAB, Inc. content, including by framing or similar means, is expressly prohibited without the prior written consent of CAB, Inc. CAB, Inc. shall not be liable for any errors in the content, or for any actions taken in reliance thereon.