hogh light the choice in the filter

F

Frank Situmorang

Hello,

I have a form in order to filter the members for certain churches in citi
Jakarta. There are 124 churches alllover Jakarta. In the filter I have to
choose for a church then we now the members of the church.

Since to go down the list will take time, so I make the default by the
church to which I gave the software, but when I test it the default church
name is not highlighted.

How can we make it the default chruch name is highlighted, so that the user
does not have to go down the list. in the list box.

Thanks for any idea.

Frank
 
K

Klatuu

This is untested "air code", but it should give you an idea on how it can be
done. The basic idea is you loop through all the items in the list and
select the one that matches the criteria (the church).

What you did not say is where the default church is identified. For example
purposes, I will show this as a function where you pass the name of the
church to the function:

Private Function HighlightChurch(DefaultChurch As String) As Boolean
Dim varItem As Variant
Dim strWhere As String
Dim ctl As Control

HighLightChurch = False

Set ctl = Me.MyListBox

With ctl
For Each varItem In .ItemData
If .ItemData(varItem) = DefaultChurch Then
.ItemData(varItem).Selected = True
HighLightChurch = False
Exit For
Next varItem
End With
End Function
 

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