Wrox Programmer Forums
|
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 December 6th, 2004, 01:28 AM
Authorized User
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to alantodd
Default Formatting a text box

Hi Everyone,

I have created a fairly regular form that shows a number of data fields across the form with the standard text box object. What I would like to do is set the color of the text and/or the back ground when a certain condition applies.

For example, is the value is positive, black text on a white background. But if the value is equal to zero, lets show the text in red. Maybe red background, with white text?

I have tried using the format property on the text box as you would in MS Excel. eg: "#,###;[red]-#,###"

This does not do the same thing as Excel, but that is the sort of thing I'm hoping to achieve.

Any ideas folks?

TIA

Alan


 
Old December 6th, 2004, 02:42 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Use Format > Conditional Formatting on the text box.

Set Default Formatting to black text on white background.

Then set the Condition 1 to Field Value Is, and then Equal To, or Less Than, and then enter "0" (for Equal To) or "1" (for Less Than [integer]). Then set your formatting to Red background, white text, maybe bold, etc.

I use conditional formatting on reports as well.

I hope this helps.



mmcdonal
 
Old December 6th, 2004, 06:09 PM
Authorized User
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to alantodd
Default

Hi,

Thanks for this. Perfect!

Never looked for this on the menus, no wonder I didn't find it!

(Wonder what else I'm missing out on?)

Alan


 
Old December 14th, 2004, 05:59 PM
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Coldendus Send a message via Yahoo to Coldendus
Default

I'm trying to mimic conditional formatting in an Access Project using VBA.

(if I do try to use the actual conditional formating with an ADO recordset in the clas module of the report, it seems to crash the project, so I'm looking for alternatives)

I suppose I'm uncertain how Reports iterate through a recordset. Is one referance to a text box sufficient to apply the formatting OR do I have to iterate through different instances of that control?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting inside Rich Text Box bettiahamit .NET Framework 3.5 1 November 10th, 2008 06:04 AM
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
Count in combo box(display results in text box) mboyisis Access 4 April 4th, 2008 07:08 AM
Saving Rich Text Box Formatting snowy0 VB.NET 2002/2003 Basics 5 February 29th, 2004 02:11 AM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





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