Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: highlighting rows in a datasheet


Message #1 by rachel.chappell@b... on Mon, 21 Oct 2002 09:59:33
Hi

I have a form which displays its associated records as a datasheet. The 
user can then select a row of data on which to perform some future 
calculation. Is there a way I can change the row backcolour of the 
selected row to make it stand out from the others?

Thanks

Rachel
Message #2 by "Gregory Serrano" <SerranoG@m...> on Mon, 21 Oct 2002 13:41:50
Rachel,

<< I have a form which displays its associated records as a datasheet. The 
user can then select a row of data on which to perform some future 
calculation. Is there a way I can change the row backcolour of the 
selected row to make it stand out from the others? >>

Access does this for you already.  When you select a field in that row, a 
black triangle appears to the far left of the row telling you which row 
you're working on.  Furthermore, if you click on the black triangle (or 
actually, the square the triangle sits on), that whole row will invert 
from black on white to white on black.

Greg
Message #3 by rachel.chappell@b... on Mon, 21 Oct 2002 15:05:24
Hi

You are quite right in your answer to my original question but I got the 
question wrong (it is Monday morning!! )

My form is not a datasheet but a tabular form. When the user selects a 
record on the tabular form (record selectors are set to visible) they do 
get the small triangle denoting that they have selected the record but the 
remaining controls for the record remain unaltered. It is possible to 
change the format of the controls for the selected record to highlight the 
entire row? If no I could change to form to a dataset.

Rachel
Message #4 by "Gregory Serrano" <SerranoG@m...> on Mon, 21 Oct 2002 18:04:14
<< My form is not a datasheet but a tabular form. >>

Oh, do you mean you're using a continuous form where you tab from one 
field to the next for each record instead of using a datasheet form?

<< It is possible to change the format of the controls for the selected 
record to highlight the entire row? If no I could change to form to a 
dataset. >>

So if someone places the cursor on any field in that row, do you want the 
background color of the form to change for that piece of continous form 
while the background colors of the other continuous forms stay the same?

Greg
Message #5 by rachel.chappell@b... on Tue, 22 Oct 2002 08:32:48
> << My form is not a datasheet but a tabular form. >>

> Oh, do you mean you're using a continuous form where you tab from one 
f> ield to the next for each record instead of using a datasheet form?

> << It is possible to change the format of the controls for the selected 
r> ecord to highlight the entire row? If no I could change to form to a 
d> ataset. >>

> So if someone places the cursor on any field in that row, do you want 
the 
b> ackground color of the form to change for that piece of continous form 
w> hile the background colors of the other continuous forms stay the same?

> Greg

Yes more or less. I am using a continuous form where you tab from one 
field to the next for each record instead of using a datasheet form. I 
have set the record selectors property of each continous form to yes. So 
the user can select the record behind the particular set of fields in that 
row by clicking on the record selector. As you say this does give me the 
small triangle in the record selector to indicate that the record ahs been 
selected but ideally I would like something more visual like a change of 
colour. 

Hope this is clearer!!

Rachel

Message #6 by "Gregory Serrano" <SerranoG@m...> on Tue, 22 Oct 2002 13:29:58
Rachael,

<< Yes more or less. I am using a continuous form where you tab from one 
field to the next for each record instead of using a datasheet form. I 
have set the record selectors property of each continous form to yes. So 
the user can select the record behind the particular set of fields in that 
row by clicking on the record selector. As you say this does give me the 
small triangle in the record selector to indicate that the record ahs been 
selected but ideally I would like something more visual like a change of 
colour. >>

Oh, OK... A topic similar to this was covered before but I cannot pinpoint 
it in the archive, even when I searched for my own name (I posted a 
solution)!  In that case, the background color depended on the value of a 
textbox.  In your case, you just want the backcolor to change no matter 
what the value is and no matter which field in that record you're pointing 
to.  Hmmm... I don't know if this will work because I've never done it 
before.  Try it and let us know.  I'm working with Access XP.

Create a textbox, hide or delete its label, and make the size of the 
textbox cover the entire form's height and width.  With this textbox 
highlighted, click FORMAT | SEND TO BACK.  Call this textbox, say, 
txtFocusBG (focus background).

Put this on the form's "On Got Focus" event:

   Me.txtFocusBG = 1

Put this on the form's "On Lost Focus" event:

   Me.txtFocusBG = 0

Next, put conditional formatting on txtFocusBG (click FORMAT | CONDITIONAL 
FORMATTING) so that when Me.txtFocusBG = 1 then the textbox's fore and 
backcolor are, say, blue; and when Me.txtFocusBG = 0 its fore/backcolor 
are gray.

Theoretically, when you click a field, the txtFocusBG will be set to = 1.  
When that happens, the conditional formatting will kick in and change its 
colors.  Because the textbox is so big that it covers the whole form, it 
will create the illusion of the form's background color changing, 
thereby "highlighting" the record.  The other records on the continuous 
form will not have focus, therefore (I hope) setting the txtFocusBG = 0 
and making the background "unhighlighted".

See if that works.

Greg
Message #7 by Lonnie Johnson <prodevmg@y...> on Tue, 22 Oct 2002 05:23:05 -0700 (PDT)
I have a couple of examples of this effect in Access97. I got in on this late and am not sure what version you are using. Email me
if you would like me to send you copies.
 
 Gregory Serrano <SerranoG@m...> wrote:Rachael,

<< Yes more or less. I am using a continuous form where you tab from one 
field to the next for each record instead of using a datasheet form. I 
have set the record selectors property of each continous form to yes. So 
the user can select the record behind the particular set of fields in that 
row by clicking on the record selector. As you say this does give me the 
small triangle in the record selector to indicate that the record ahs been 
selected but ideally I would like something more visual like a change of 
colour. >>

Oh, OK... A topic similar to this was covered before but I cannot pinpoint 
it in the archive, even when I searched for my own name (I posted a 
solution)! In that case, the background color depended on the value of a 
textbox. In your case, you just want the backcolor to change no matter 
what the value is and no matter which field in that record you're pointing 
to. Hmmm... I don't know if this will work because I've never done it 
before. Try it and let us know. I'm working with Access XP.

Create a textbox, hide or delete its label, and make the size of the 
textbox cover the entire form's height and width. With this textbox 
highlighted, click FORMAT | SEND TO BACK. Call this textbox, say, 
txtFocusBG (focus background).

Put this on the form's "On Got Focus" event:

Me.txtFocusBG = 1

Put this on the form's "On Lost Focus" event:

Me.txtFocusBG = 0

Next, put conditional formatting on txtFocusBG (click FORMAT | CONDITIONAL 
FORMATTING) so that when Me.txtFocusBG = 1 then the textbox's fore and 
backcolor are, say, blue; and when Me.txtFocusBG = 0 its fore/backcolor 
are gray.

Theoretically, when you click a field, the txtFocusBG will be set to = 1. 
When that happens, the conditional formatting will kick in and change its 
colors. Because the textbox is so big that it covers the whole form, it 
will create the illusion of the form's background color changing, 
thereby "highlighting" the record. The other records on the continuous 
form will not have focus, therefore (I hope) setting the txtFocusBG = 0 
and making the background "unhighlighted".

See if that works.

Greg

Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Let me build your next MS Access database application. 





---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
Message #8 by rachel.chappell@b... on Tue, 22 Oct 2002 16:14:07
> 
I have a couple of examples of this effect in Access97. I got in on this 
late and am not sure what version you are using. Email me if you would 
like me to send you copies.
 
 Gregory Serrano <SerranoG@m...> wrote:Rachael,

<< Yes more or less. I am using a continuous form where you tab from one 
field to the next for each record instead of using a datasheet form. I 
have set the record selectors property of each continous form to yes. So 
the user can select the record behind the particular set of fields in that 
row by clicking on the record selector. As you say this does give me the 
small triangle in the record selector to indicate that the record ahs been 
selected but ideally I would like something more visual like a change of 
colour. >>

Oh, OK... A topic similar to this was covered before but I cannot pinpoint 
it in the archive, even when I searched for my own name (I posted a 
solution)! In that case, the background color depended on the value of a 
textbox. In your case, you just want the backcolor to change no matter 
what the value is and no matter which field in that record you're pointing 
to. Hmmm... I don't know if this will work because I've never done it 
before. Try it and let us know. I'm working with Access XP.

Create a textbox, hide or delete its label, and make the size of the 
textbox cover the entire form's height and width. With this textbox 
highlighted, click FORMAT | SEND TO BACK. Call this textbox, say, 
txtFocusBG (focus background).

Put this on the form's "On Got Focus" event:

Me.txtFocusBG = 1

Put this on the form's "On Lost Focus" event:

Me.txtFocusBG = 0

Next, put conditional formatting on txtFocusBG (click FORMAT | CONDITIONAL 
FORMATTING) so that when Me.txtFocusBG = 1 then the textbox's fore and 
backcolor are, say, blue; and when Me.txtFocusBG = 0 its fore/backcolor 
are gray.

Theoretically, when you click a field, the txtFocusBG will be set to = 1. 
When that happens, the conditional formatting will kick in and change its 
colors. Because the textbox is so big that it covers the whole form, it 
will create the illusion of the form's background color changing, 
thereby "highlighting" the record. The other records on the continuous 
form will not have focus, therefore (I hope) setting the txtFocusBG = 0 
and making the background "unhighlighted".

See if that works.

Greg

Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Let me build your next MS Access database application. 





---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site


Hi Thanks for the suggestion. There appears not to be any conditional 
formatting in access 97 but I can do it in Access 2K. However clicking on 
the txt box on a particular record turns all of the txt boxes red across 
all the records on the continuous forms.

Is there a way of trapping the event relating to the selection of a 
record/form when it is displayed as part of a continous forms. ie the 
system must know when the user has selected a record as it displays an 
arrow in the record selector! I can refer in code to the values of the 
fields relating to the specific record but any changes to the control 
format is applied to all the controls on the continous form.

Any ideas 

Rachel

  Return to Index