Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access 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 March 16th, 2006, 08:41 AM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default colour continuous form

I am attempting to colour records in a continuous form based on 5 different conditions. Conditional format only has 4 options so I wondered if there was a way using VBA. I have managed to colour a report using a series of IF's in VBA and setting it to the OnPrint option, but as far as I am aware there is not an equivalent option in forms.
 
Old March 17th, 2006, 01:13 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Good question. I was unable to find anything, although I know there must be code for the fill/backcolor somehow.

Here is a brute force way of doing it:

Make colored rectangles in your favorite application (PhotoShop, ImageReady, MS Paint) and save them as .jpg files.

Add all of them to your form so they cover the entire form area.

Make all of them invisible, and send them all to back.

Then with your code, on the form's OnCurrent event, select the image and make it visible depending on what is in the pertinent text box or other control.

This will work. A little kludy, I know, but no one here ever accused me of being elegant. I am sure Bob or Greg can come up with something pretty. This will work till they post.

HTH


mmcdonal
 
Old March 17th, 2006, 01:15 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I forgot to mention, make one of them visible, and all the others invisible depending on the condition, else all of them invisible.

You should use Select Case.

HTH

mmcdonal
 
Old May 25th, 2006, 07:26 AM
Authorized User
 
Join Date: Apr 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lizhaskin
Default

Hi
Did you ever get a workable answer to this? I have the same situation and am totally stumped.
Liz


 
Old July 29th, 2009, 03:26 AM
Registered User
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Solution does not get desired result

Quote:
Originally Posted by mmcdonal View Post
Good question. I was unable to find anything, although I know there must be code for the fill/backcolor somehow.

Here is a brute force way of doing it:

Make colored rectangles in your favorite application (PhotoShop, ImageReady, MS Paint) and save them as .jpg files.

Add all of them to your form so they cover the entire form area.

Make all of them invisible, and send them all to back.

Then with your code, on the form's OnCurrent event, select the image and make it visible depending on what is in the pertinent text box or other control.

This will work. A little kludy, I know, but no one here ever accused me of being elegant. I am sure Bob or Greg can come up with something pretty. This will work till they post.

HTH


mmcdonal
This solution doesn't work. You can't get different colours/images in different records of continuous forms this way.

What will happen is that because it is set to the OnCurrent Event, as soon as a particular record gets the focus, its condition statement (either If or Select) will activate in the code (OnCurrent Event) and set the formatting of all records to the same result.

It looks like the only way to do it (without buying add-on software) is to use conditional formatting and be limited to the default formatting and the additional 3 conditions.

Another sneaky way might be to have two or more fields/labels overlapping, make them "disappear" using the third condition, so that the next overlapping field satisfies the condition in one of its conditions, if that makes sense.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Continuous Form - Images nilkanth Access 9 July 29th, 2009 02:30 AM
Changing Fore colour and back colour darrenb Access VBA 2 May 25th, 2007 07:10 AM
Colored Rows in Continuous Form anyyoyo Access VBA 3 June 8th, 2006 12:21 PM
Continuous form / SetFocus help dbartelt Access 5 February 13th, 2006 03:59 PM
Write Conflict in continuous Form pinkandthebrain Access 2 July 18th, 2003 11:16 AM





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