PC Review


Reply
Thread Tools Rate Thread

Changing a form color depending on a variable value

 
 
Tony
Guest
Posts: n/a
 
      1st Jan 2010
Hello

I wish to change the color of a form depending on the value of a variable.
If the var "SigOther" [boolean] is true then I want the form to be pink else
a light blue.

Thanks a lot

 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      1st Jan 2010
Tony

Where is that "variable"? Is it part of a procedure, or are you referring
to a control on the form?

If a control on a form, one approach might be to use the AfterUpdate event
of that control and set the form's background color to whatever...

--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Tony" <(E-Mail Removed)> wrote in message
news:CEB99123-CCB6-42E1-B9AA-(E-Mail Removed)...
> Hello
>
> I wish to change the color of a form depending on the value of a variable.
> If the var "SigOther" [boolean] is true then I want the form to be pink
> else a light blue.
>
> Thanks a lot



 
Reply With Quote
 
Tony
Guest
Posts: n/a
 
      1st Jan 2010
Sorry about that.
It is a field on a form taken from a table

"Jeff Boyce" <(E-Mail Removed)-DISCARD-HYPHEN-TO-END> wrote in message
news:(E-Mail Removed)...
> Tony
>
> Where is that "variable"? Is it part of a procedure, or are you referring
> to a control on the form?
>
> If a control on a form, one approach might be to use the AfterUpdate event
> of that control and set the form's background color to whatever...
>
> --
>
> Regards
>
> Jeff Boyce
> Microsoft Access MVP
>
> Disclaimer: This author may have received products and services mentioned
> in
> this post. Mention and/or description of a product or service herein does
> not constitute endorsement thereof.
>
> Any code or pseudocode included in this post is offered "as is", with no
> guarantee as to suitability.
>
> You can thank the FTC of the USA for making this disclaimer
> possible/necessary.
>
> "Tony" <(E-Mail Removed)> wrote in message
> news:CEB99123-CCB6-42E1-B9AA-(E-Mail Removed)...
>> Hello
>>
>> I wish to change the color of a form depending on the value of a
>> variable.
>> If the var "SigOther" [boolean] is true then I want the form to be pink
>> else a light blue.
>>
>> Thanks a lot

>
>


 
Reply With Quote
 
Daniel Pineault
Guest
Posts: n/a
 
      1st Jan 2010
you can change the back ground color quite easily. see
http://www.devhut.net/index.php?lang...chgBkgrndColor

To determine the color to use you can use the color utility I created, which
can be found at http://www.devhut.net/index.php?lang...0000007#colors

But basically you'd use the afterupdate event and the current event of the
form and do something like the following for each of them

If SigOther = True then
Me.Section(acDetail).BackColor = 16757247 'Pink
Else
Me.Section(acDetail).BackColor = -958615391 'Light Blue
End if

You need to use the after update for the SigOther control to adjust when the
user makes changes, but also need to use the oncurrent to adjust between
records when they get loaded.
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.



"Tony" wrote:

> Hello
>
> I wish to change the color of a form depending on the value of a variable.
> If the var "SigOther" [boolean] is true then I want the form to be pink else
> a light blue.
>
> Thanks a lot
>

 
Reply With Quote
 
Tony
Guest
Posts: n/a
 
      1st Jan 2010
It works a treat.
I live in Darwin so I'll go to bed and sleep well.

Thanks a lot
"Daniel Pineault" <(E-Mail Removed)> wrote in
message news:EEAD625D-5738-4357-B43D-(E-Mail Removed)...
> you can change the back ground color quite easily. see
> http://www.devhut.net/index.php?lang...chgBkgrndColor
>
> To determine the color to use you can use the color utility I created,
> which
> can be found at
> http://www.devhut.net/index.php?lang...0000007#colors
>
> But basically you'd use the afterupdate event and the current event of the
> form and do something like the following for each of them
>
> If SigOther = True then
> Me.Section(acDetail).BackColor = 16757247 'Pink
> Else
> Me.Section(acDetail).BackColor = -958615391 'Light Blue
> End if
>
> You need to use the after update for the SigOther control to adjust when
> the
> user makes changes, but also need to use the oncurrent to adjust between
> records when they get loaded.
> --
> Hope this helps,
>
> Daniel Pineault
> http://www.cardaconsultants.com/
> For Access Tips and Examples: http://www.devhut.net
> Please rate this post using the vote buttons if it was helpful.
>
>
>
> "Tony" wrote:
>
>> Hello
>>
>> I wish to change the color of a form depending on the value of a
>> variable.
>> If the var "SigOther" [boolean] is true then I want the form to be pink
>> else
>> a light blue.
>>
>> Thanks a lot
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Cell Background Color Depending on the Number Matlock Microsoft Excel Misc 1 18th Feb 2008 12:41 AM
Changing cell or text color depending on week number Roger Microsoft Excel Misc 2 12th Apr 2005 09:42 AM
Changing a code Variable from a form =?Utf-8?B?TmV2aWUgYW5kIFBoaWw=?= Microsoft Access Form Coding 5 17th Feb 2005 01:33 PM
Changing color of a row depending on coloum values? Lars Rasmussen Microsoft Excel Programming 2 6th Jan 2005 10:16 AM
Changing the color of a button on a form Rebecca Microsoft Access Forms 3 14th Jul 2004 05:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:33 PM.