Hi Allen,
I like to use and then test the TAG property (Other tab, last property) of controls.
ie:
on the GotFocus event, send execution to a general procedure such as this:
'~~~~~~~~~~~~~~~~~~
with me.activecontrol
select case true
case instr(.tag,"Yellow") > 0
.BackColor = vbYellow
case instr(.tag,"White") > 0
.BackColor = vbWhite
end select
end with
'~~~~~~~~~~~~~~~~~~
I usually delimit with ~ with I combine things in the TAG -- ie: case instr(.tag,"~Yellow~") > 0
You can also test the entire tag
case .tag = "Yellow"
or
'~~~~~~~~~~~~~~~~~~
If .tag = "Yellow" then
' do something
elseIf .tag = "White" then
'do something else
else
'nothing matched
end if
'~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~
... but did you know that you can :
1. set the backcolor property of a control
2. set the control back style to transparent
then, when you are IN the control, it will have the backcolor that you specified, otherwise it will be transparent? I almost always do this as an additional clue to the user where they are ;)
Warm Regards,
Crystal
Learn Access on YouTube
http://www.YouTube.com/LearnAccessByCrystal
*
(: have an awesome day :)
*
________________________________
From: Allen Bennett
Subject: [MS_AccessPros] Control Arrays
I'm used to this in VB6. How do I implement a similar thing in an Access
2007 form? I'd rather no do each text box (of a dozen) separately.
Private Sub Text1_GotFocus(Index As Integer)
Text1(Index).BackColor = vbYellow
End Sub
Private Sub Text1_LostFocus(Index As Integer)
Text1(Index).BackColor = vbWhite
End Sub
Allen Bennett
[Non-text portions of this message have been removed]
Rabu, 08 Agustus 2012
Re: [MS_AccessPros] Control Arrays
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar