How to highlight textboxes on continuous form using Got Focus/Lost Focus in access?

Jarred Meyer
Jarred Meyer used Ask the Experts™
on
I set up my textboxes to highlight when On Got Focus and then change back to white On Lost Focus on my continuous form. The problem I notice is that when it highlights the textbox for the particular row it does the same for all of the rows.. Is there a way to highlight just within the detail row that the box is selected?

Here is my vba for On Focus and Lost Focus for one of the textboxes.

Private Sub AssemblySeq_GotFocus()

Me.AssemblySeq.BackColor = RGB(153, 204, 255)

End Sub

Private Sub AssemblySeq_LostFocus()

Me.AssemblySeq.BackColor = vbWhite

End Sub



Thanks for the help!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Bill RossProgrammer

Commented:
Hi,

This is normal operation.  Note that in a continuous form all text boxes have the same name per record so when you change the text box property of Me.AssemblySeq you are referring to each one of them per record.

Regards,

Bill
Top Expert 2016
Commented:
have you tried using conditional formatting?
SeyerIT,
You'll need to use Conditional Formatting to get change the look of one/some but not all records.

In Access 2010 (and I think 2007 as well), you can do this easily with the Conditional Formatting Wizard:

Form Design
Select control(s)
Format ribbon
Conditional Formatting
New Rule
Check values in current record ...
Field has focus
set your format
CF exampleThe bonus is that you can the Format Painter tool to copy the same CF to other controls (or select multiple controls and create the CF simultaneously).

pT72
Jarred MeyerProduction Manager

Author

Commented:
Oh geez that is fantastic... I never even noticed the Got Focus option in there.. Learn something new every day.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial