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 February 8th, 2006, 02:33 AM
Authorized User
 
Join Date: Feb 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access VBA - Controlling Text boxes in a form

Hi, have a question here on controlling the appearance of a textbox in a form.

Currently, I have a form which is has its recordsource linked to a table with 5 records.
Each of these records have the Field -> "Cost"
The form, when loaded, will display all 5 records in a "Continuous Forms View". The "Cost" Field is displayed as a textbox.

How do I, using VBA, control the appearance of the text boxes?
For example, if "Cost" > 10, Use Black background for the textbox
and if "Cost" <=9, Use Green background for the text?

Any help will be greatly appreciated!

Scripts82
__________________
Scripts82
 
Old February 8th, 2006, 07:16 AM
Authorized User
 
Join Date: Feb 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You mean at run time ?
Because if it do - you need to implement the TextChange Event (see in events Tab) and to use conditions and to set BackColor property of the TextBox .



 
Old February 8th, 2006, 08:51 AM
Authorized User
 
Join Date: Feb 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hmm... the change event doesn't seem to fit the case...
actually not really run time....
the text boxs each contains a number (binded) to a table...
upon load, if the number in the textbox is larger than 0,
I will need the text box to be changed to a different colour

Onload doesn't work correctly ...
Change event doesn't work too as the text is not "changed" during run time...



Scripts82
 
Old February 8th, 2006, 10:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Click on the textbox and then on the menu, choose FORMAT > CONDITIONAL FORMATTING. That will change the appearance of ONE box at a time vs. ALL the boxes at the same time.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old February 8th, 2006, 08:35 PM
Authorized User
 
Join Date: Feb 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks! that worked fine... Didn't know this function before!

Scripts82





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with VBA Disable/Enable text boxes yayomayn Access VBA 4 February 10th, 2007 08:43 PM
hiding empty text boxes in an Access report EricTheViking Access 4 September 7th, 2006 11:43 AM
Word VBA - Text Form Field dkr72 Excel VBA 1 December 22nd, 2004 11:09 AM
Form Text Boxes mrideout BOOK: Beginning ASP.NET 1.0 8 September 3rd, 2004 12:43 PM
Beginning Access 2000 VBA Chapter 6: List Boxes greencw BOOK: Beginning Access VBA 1 June 13th, 2004 08:16 PM





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