473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Highlighting a row that has been selected.

kcdoell
230 100+
Hello:

In my continuous form, if I select a row a small arrow button displays in the far left. What is the best way to have the background color change for just that row. I have figured out how to do this for any particular field that is selected but not the entire row.

Any ideas would be helpful.

Thanks,

Keith.
Apr 9 '08 #1
12 1713
kcdoell
230 100+
Hello:

In my continuous form, if I select a row a small arrow button displays in the far left. What is the best way to have the background color change for just that row. I have figured out how to do this for any particular field that is selected but not the entire row.

Any ideas would be helpful.

Thanks,

Keith.
Hello again:

To further clarify, since I know how to do this using the "get focus" / "Lost focus" of a particular field's properties on the form, I was wondering whether I could set this property (forecolor) for the whole record, rather than just one field?

Any ideas would be helpful,

Thanks,

Keith.
Apr 9 '08 #2
FishVal
2,653 Expert 2GB
Hi, Keith.

I recall something similar in http://bytes.com/forum/thread748875.html

Regards,
Fish
Apr 9 '08 #3
kcdoell
230 100+
Fish:

I read the other thread and I am still confused because I am not using a check box to highlight but rather the default arrow indicator that displays when a user selects a row. I have an image of this in another thread.
[HTML]http://bytes.com/forum/thread792157.html[/HTML]

I am not too sure where I go from here.

Can you shed more light?

Thanks,

Keith.
Apr 9 '08 #4
FishVal
2,653 Expert 2GB
Hi, Keith.

AS you've already figured it out setting property of control on form in continuous or datasheet view will affect all rows as it basically just the same control. The only way (at least I know only this one :)) to change control appearance for a particular row is to use conditional formatting.

The logic I've used is the following:
  • conditional formatting may accept a value of a field in a record as criteria
  • that means field value has to indicate whether the record is active
  • obviously it requires an additional field in the bound table, boolean field will serve quite well - let us call it blnIsActive
  • conditional format of all form controls is set to change background colour when [blnIsActive]=True
    Expand|Select|Wrap|Line Numbers
    1. Expression is
    2. [Forms]![Form name]![blnIsActive]=True
    3.  
  • now we need to change [blnIsActive] value to True when record gets focus and reset to False when it looses focus.

    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_BeforeUpdate(Cancel As Integer)
    2.     Me.blnIsActive = False
    3. End Sub
    4.  
    5. Private Sub Form_Current()
    6.     If Not Me.NewRecord Then Me.blnIsActive = True
    7. End Sub
    8.  
    Note: no control, either visible or not, bound to [blnIsActive] is needed on the form.

Regards,
Fish
Apr 9 '08 #5
kcdoell
230 100+
Fish:

I am trying to apply this method:

I went to one of my controls on my form (Policy_Type), right click, went to conditional formating, selected "expresion is" and inputted the following:
Expand|Select|Wrap|Line Numbers
  1. [Forms]![Forecast]![blnIsActive]=True
  2.  
Then I inputed the code to my form:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.     Me.blnIsActive = False
  3. End Sub
  4.  
  5. Private Sub Form_Current()
  6.     If Not Me.NewRecord Then Me.blnIsActive = True
  7. End Sub
  8.  
But nothing happens. You said that "blnIsActive" was not needed on my form. Do I need to add it to my table?? I believe I would. I am thinking that that is where I am making the mistake in your solution.

Any ideas?

Thanks,

Keith.
Apr 9 '08 #6
kcdoell
230 100+
Fish:

I now you must be busy but when you have the time if you could give me a little more detail on how I incorporate "blnIsActive" that would be great. I never applied a boolean expresion let alone now exactly what it is. I am going to do some research on Booleans.

Let me know your thoughts

and thanks!

Keith.
Apr 10 '08 #7
kcdoell
230 100+
Fish:

I think a lightbulb went off in my head about boolean (Yes/No field in Access). I am going to try that........

Keith.
Apr 10 '08 #8
FishVal
2,653 Expert 2GB
.....
You said that "blnIsActive" was not needed on my form. Do I need to add it to my table?? I believe I would. I am thinking that that is where I am making the mistake in your solution.
.....
It is what the whole logic is based on. Have you added [blnIsActive] field to the table?

Kind regards,
Fish
Apr 10 '08 #9
kcdoell
230 100+
Fish:

Okay, I think I am getting there. What I did was create a new field on my table called "RowIsActive" and set its data type to Yes/No. Then I put the following code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.  
  3. Me.RowIsActive = False
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     If Not Me.NewRecord Then Me.RowIsActive = True
  3. End Sub
I hit the error on the later. I thought I was going to have an issue because when I was typing in the "me." expression "RowIsActive" was not a selection for me to choose from. Hence, when I opened the form I hit an error
Expand|Select|Wrap|Line Numbers
  1. "Method or data member not found (Error 461)" 
My row source for this form is pointing to a query I created. I made sure that the "RowIsActive" field was included in the query but still the same error. I believe you indicated that I did not have to place the field on the form itself in order for this to work.

Am I correct on that understanding?

Thanks,

Keith.
Apr 10 '08 #10
FishVal
2,653 Expert 2GB
Actually as long as [RowIsActive] field is among the fields returned by form recordsource it should be available as property of the form object or a member of form controls collection:
Me.FieldName
or
Me!FieldName

As an option you may put a control (e.g. checkbox) bound to [RowIsActive] field.
Give it the same name - [RowIsActive] to make no changes to code. This way the code will not throw the error as the references will be to the existing control and you will see how its value changes when selecting different records.

Regards,
Fish
Apr 10 '08 #11
kcdoell
230 100+
Actually as long as [RowIsActive] field is among the fields returned by form recordsource it should be available as property of the form object or a member of form controls collection:
Me.FieldName
or
Me!FieldName
As .......................................
Regards,
Fish

Fish:

All I had to do was change the code to Me!FieldName and it worked. To better understand this, what made the difference?? That is to say I know that I changed the "." to a "!" but how can Access find the control in one way and not the other?

I hate the fact that I am wasting your precious time on little formatting issues.

Thanks,

Keith.
Apr 10 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: windandwaves | last post by:
Hi Folk Is there anyone out there who knows if there is an easy way to highlight the currentrecord using conditional formatting or something like that in Access 2003? Thank Nicolaas
4
by: Bob hotmail.com> | last post by:
Everyone I have been spending weeks looking on the web for a good tutorial on how to use regular expressions and other methods to satisfy my craving for learning how to do FAST c-style syntax...
2
by: Carolyn Vo | last post by:
I have been looking and looking but can't seem to find out how to get the row selected in a web control datagrid (NOT a web form datagrid!!!), and how to highlight the selected row. I'm sure this...
0
by: Charlie | last post by:
I have the following code but I can't get the selected text to highlight correctly. What happens is all the text after the selected text is red. I need to add that after the selected text is...
4
by: Patrick Porter | last post by:
Arrrgh! I have tried everything (ok, not EVERYTHING) but i cant get solve the problem of getting syntax highlighting in a rich textbox. in the code below, im attempting to highlight all of the...
7
by: brendan.wong | last post by:
hello. i have a really simple form that asks the user to select a Month from a dropdown. the first time a user visits the page, the highlighted option should be October, which works fine. then,...
1
by: =?Utf-8?B?SmVmZiBUdQ==?= | last post by:
Hi, I'm using two menu controls. One is displayed at the top of the page. The other menu is displayed on the left side using a single site map. The top menu is for displaying level 1. The left...
14
by: > Adrian | last post by:
Is there a way of stopping text from highlighting in textbox? Many thanks, Adrian.
4
by: rajeshnrh74 | last post by:
Hi Gurus, I need one solution I'm using VB6, one of its Form contains a TextBox What i need is whatever characters I type in it that should be highlighted ex First when I type "a" -> "a" ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.