Solved

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

Posted on 2014-01-21
3
764 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

710 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