dbTalk Databases Forums  

change text colour in continuous form

comp.databases.ms-access comp.databases.ms-access


Discuss change text colour in continuous form in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Phil Rushton
 
Posts: n/a

Default change text colour in continuous form - 02-17-2011 , 10:33 AM






Hi

I have a database with a form that displays records in continuous form view.
I would like to change the colour of the line of text when a record is
selected

Phil

Reply With Quote
  #2  
Old   
John Spencer
 
Posts: n/a

Default Re: change text colour in continuous form - 02-17-2011 , 11:52 AM






You can try the following:

Add an unbound control to your form header
==Control Name: txtCurrentRecord
==Visible: No (unless you want to show the value for some reason)

Add another unbound control to your form in the detail section
==Control Name: txtHighlight
==Visible: Yes
==Back Style: Normal
==Back Color: -2147483643 (or whatever color you are using for the form section)
==Special Effect: Flat
==Border Style: Transparent
==Size the control so it is the size of the row

Select txtHighlight and then select Conditional Formatting
==Set Condition 1 to
Expression is: [txtCurrentRecord] = [PrimaryKeyField]
==Select the Back Color you want to use as a highlight
==Click OK button

Now, send the control txtHighlight to the back so it is behind all your other
controls (Menu: Format: Send to Back

Select all the other controls on the row and set their Back Style to Transparent
You don't need to change the Border Style

In the Form's current Event add a line of code
Private Sub Form_Current()
Me.txtCurrentRecord = Me!PrimaryKeyField
End Sub


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 2/17/2011 11:33 AM, Phil Rushton wrote:
Quote:
Hi

I have a database with a form that displays records in continuous form view.
I would like to change the colour of the line of text when a record is
selected

Phil


Reply With Quote
  #3  
Old   
Phil Rushton
 
Posts: n/a

Default Re: change text colour in continuous form - 02-18-2011 , 06:31 AM



Brilliant

Thank you so much. This has been driving me crazy.

Phil

"John Spencer" <JSPENCER (AT) Hilltop (DOT) umbc> wrote

Quote:
You can try the following:

Add an unbound control to your form header
==Control Name: txtCurrentRecord
==Visible: No (unless you want to show the value for some reason)

Add another unbound control to your form in the detail section
==Control Name: txtHighlight
==Visible: Yes
==Back Style: Normal
==Back Color: -2147483643 (or whatever color you are using for the form
section)
==Special Effect: Flat
==Border Style: Transparent
==Size the control so it is the size of the row

Select txtHighlight and then select Conditional Formatting
==Set Condition 1 to
Expression is: [txtCurrentRecord] = [PrimaryKeyField]
==Select the Back Color you want to use as a highlight
==Click OK button

Now, send the control txtHighlight to the back so it is behind all your
other controls (Menu: Format: Send to Back

Select all the other controls on the row and set their Back Style to
Transparent
You don't need to change the Border Style

In the Form's current Event add a line of code
Private Sub Form_Current()
Me.txtCurrentRecord = Me!PrimaryKeyField
End Sub


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 2/17/2011 11:33 AM, Phil Rushton wrote:
Hi

I have a database with a form that displays records in continuous form
view.
I would like to change the colour of the line of text when a record is
selected

Phil


Reply With Quote
  #4  
Old   
John Spencer
 
Posts: n/a

Default Re: change text colour in continuous form - 02-18-2011 , 08:11 AM



Glad it worked.

I was afraid I might have left out some requirements to make it work.


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 2/18/2011 7:31 AM, Phil Rushton wrote:
Quote:
Brilliant

Thank you so much. This has been driving me crazy.

Phil

"John Spencer"<JSPENCER (AT) Hilltop (DOT) umbc> wrote in message
news:ijjn9g$30n$1 (AT) news (DOT) eternal-september.org...
You can try the following:

Add an unbound control to your form header
==Control Name: txtCurrentRecord
==Visible: No (unless you want to show the value for some reason)

Add another unbound control to your form in the detail section
==Control Name: txtHighlight
==Visible: Yes
==Back Style: Normal
==Back Color: -2147483643 (or whatever color you are using for the form
section)
==Special Effect: Flat
==Border Style: Transparent
==Size the control so it is the size of the row

Select txtHighlight and then select Conditional Formatting
==Set Condition 1 to
Expression is: [txtCurrentRecord] = [PrimaryKeyField]
==Select the Back Color you want to use as a highlight
==Click OK button

Now, send the control txtHighlight to the back so it is behind all your
other controls (Menu: Format: Send to Back

Select all the other controls on the row and set their Back Style to
Transparent
You don't need to change the Border Style

In the Form's current Event add a line of code
Private Sub Form_Current()
Me.txtCurrentRecord = Me!PrimaryKeyField
End Sub


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 2/17/2011 11:33 AM, Phil Rushton wrote:
Hi

I have a database with a form that displays records in continuous form
view.
I would like to change the colour of the line of text when a record is
selected

Phil




Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.