Change Backcolor for the selected line

  • Thread starter al416 via AccessMonster.com
  • Start date
A

al416 via AccessMonster.com

I would like to be able to highlight or change the color of a single line on
a subform formated as a continuous form.

The user selects one line from many possible lines on a continuous form to
respond to. When he selects the line another pop-up form is display which the
user must complete.

I would like to maintain some kind of highlight (backcolor?) so that the user
can clearly see which line he is reponding to.

Setting the backcolor after selecting a line sets the back color for the
entire form, which really defeats the purpose.

Any help?
 
C

Crystal (strive4peace)

Instead of using a line, use a textbox -- make it short and
wide like a line. Use conditional formatting for the
textbox backcolor so your lines can be different colors for
different records depending on your criteria <smile>

You will also want to set these properties:
Locked = True
Enabled = False

~~~

or are you using "Line" to mean the record of data?

TO HIGHLIGHT THE CURRENT RECORD IN A CONTINUOUS FORM

put the following textbox control on your form (I usually
put it in the footer since there is often more unused space)

name --> RecordID_current
visible --> no

make the following textbox control in the detail section of
your form:

name --> HighlightBox
left --> 0
top --> 0
width --> width of detail section
height --> height of detail section, like 0.2
enabled --> false
locked --> true
tabstop --> false

send this control to the back*

in the design view of the form, select HighlightBox
since HighlightBox is behind everything, you may need to
select it using the object drop-down (1st icon on the
formatting toolbar or combo in the Properties window at the
top)

conditional formatting
condition 1 --> Expression Is
--> [RecordID] = [RecordID_current]

example to also highlight a new record:
[RecordID_current] = nz([GrpID],RecordID_current)

change fill/back color to LIGHT YELLOW or light gray
or whatever color you want for your highlight

If my detail section background is White, I like to use
light yellow for a highlight

WHERE
RecordID is the controlname of your ID field control

then, in the form OnCurrent event, assign a value to the
unbound RecordID_current
being unbound, it will have the same value on every record

'~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub Form_Current()
Me.RecordID_current = IIf([NewRecord], 0, [RecordID])
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~
'needed in Access 2007
Private Sub Form_BeforeInsert()
Me.RecordID_current = me.RecordID
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~

where [RecordID] is the controlname (or fieldname)
corresponding to your unique ID.


Warm Regards,
Crystal
remote programming and training
http://MSAccessGurus.com

free video tutorials
http://www.YouTube.com/user/LearnAccessByCrystal

Access Basics
http://www.AccessMVP.com/strive4peace
free 100-page book that covers essentials in Access

*
:) have an awesome day :)
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top