Kamis, 09 Agustus 2012

[MS_AccessPros] Re: Control Arrays

 

I haven't seen any workarounds which save much effort.

One trick I have used is to set the Event Procedures to be something like =MyLostFocus(1) for the first control or =MyLostFocus(12) for the 12th control or similar.

Then the routine would be:

Function MyLostFocus(Index As Integer) as integer

Me.Controls("Text" & Index).BackColor = vbWhite

End function

However, if the only thing you are trying to do is set the backcolor to hightlight the focus, use the Conditional Formating and Access will look after it for you.

Yours, Andrew

--- In MS_Access_Professionals@yahoogroups.com, Allen Bennett <Allen@...> wrote:
>
> 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]
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar