Solved

How to change the color of the selected line in a subform

Posted on 2014-01-21
3
680 Views
Last Modified: 2014-01-22
Hi,

I want to change the color of the selected line in a subform.
Now i have set all fields backcolor to Transparent.
I have made a textbox "TBox" in size the same as all the other controls and it is set to "send to back".
When i select a line and i execute the code and i set a breakpoint just before "Me!TBox.Visible = True" and then use F8 then everything works fine.
When i execute the code in a normal way the color don't change.
In the on_current event i have :
Me!TBox.Visible = False
and in the on_click event of a certain field i have at the end of a code :
Me!TBox.Visible = True
0
Comment
Question by:sonmic
3 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 39797095
try adding this line

Me.TBox.Visible = True
me.repaint   'add this line
0
 

Author Comment

by:sonmic
ID: 39797199
Tx, but the result is the same.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39797234
Are you trying to set a background color for the currently selected line in a continuous form?

Instead of setting the visible property (this won't work the way you want with a continuous form),  try this:


- Add a hidden textbox called txtHold to your form (Visible = False, always).  It will be used to hold the ID of the currently selected record.

- In the current event of your form, add the following:
   Me.txtHold = Me.YourIDField

Open in new window


Take out the code which toggles the visible property of the large background textbox and instead use Conditional Formatting.

- Right-click your background textbox in design view and click Conditional Formatting...

- Create a new rule, and select "Expression Is" from the drop-down list

- Enter this expression into the textbox provided for the conditional formatting expression:
        [txtHold] = [YourIDField]

Open in new window

  (YourIDField should be the name of your primary key field as it appears in the underlying table.  This expression is criteria for determining the 'currently selected row')

-  Select the background color you want for your textbox when that condition is met.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now