A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Changing the background color of a control



 
 
Thread Tools Display Modes
  #1  
Old July 12th, 2009, 08:52 PM posted to microsoft.public.access.forms
Abay
external usenet poster
 
Posts: 112
Default Changing the background color of a control

Hello ... I use the following code to change the background color of a
control when the value in another control (total) is 0

If Dair_trans 0 Then
Ddesc.BackStyle = 1
Ddesc.BackColor = vbRed
Else
Ddesc.BackStyle = 0

End If

When I click Ddesc and the value of total is 0 the color changes on all
the lines (a multiline form) regardless of the value of the total control

Is there a way to change the colour of the control in question only if the
condition is met and for it to say colored .. ie the control on that line
only is changed.

Any help would be most appreciate.

Abay


  #2  
Old July 12th, 2009, 11:05 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Changing the background color of a control

Look into Conditional Formatting.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Abay" wrote in message
...
Hello ... I use the following code to change the background color of a
control when the value in another control (total) is 0

If Dair_trans 0 Then
Ddesc.BackStyle = 1
Ddesc.BackColor = vbRed
Else
Ddesc.BackStyle = 0

End If

When I click Ddesc and the value of total is 0 the color changes on all
the lines (a multiline form) regardless of the value of the total control

Is there a way to change the colour of the control in question only if the
condition is met and for it to say colored .. ie the control on that line
only is changed.

Any help would be most appreciate.

Abay



  #3  
Old July 13th, 2009, 02:06 AM posted to microsoft.public.access.forms
Abay
external usenet poster
 
Posts: 112
Default Changing the background color of a control

Many thanks for your reply Doug .. will try out conditional formatting ..

Abay

"Douglas J. Steele" wrote in message
...
Look into Conditional Formatting.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Abay" wrote in message
...
Hello ... I use the following code to change the background color of a
control when the value in another control (total) is 0

If Dair_trans 0 Then
Ddesc.BackStyle = 1
Ddesc.BackColor = vbRed
Else
Ddesc.BackStyle = 0

End If

When I click Ddesc and the value of total is 0 the color changes on
all the lines (a multiline form) regardless of the value of the total
control

Is there a way to change the colour of the control in question only if
the condition is met and for it to say colored .. ie the control on that
line only is changed.

Any help would be most appreciate.

Abay





 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.