M
mcnewsxp
is there multi select combobox in access 2003?
tia,
mcnewsxp
tia,
mcnewsxp
Duane Hookom said:You can use a multi select list box. I you want this control to shrink to
display only a single value and take up less space on your form, you can
use
some mouse event code. Consider list box "lboEmployees" with a rectangle
control around the outside "boxShrink"
|=boxShrink==|
| Employees |
| Bob |
| Mary |
|==========|
When designing the form, make the list box display only one record and
place
the box around the control and label and make the Line/Border width of the
boxShrink 6 points. Make the boxShrink color Transparent and send the
control to the Back. Then add code to the form as noted below. When your
mouse moves over the list box, it will expand to show all values. You may
want to limit this expansion to a smaller size. When the mouse moves out
of
the list box and crosses the boxShrink control, the list box and boxShrink
will shrink.
'==== begin code =======
Option Compare Database
Option Explicit
Const intItemHeight As Integer = 230
Private Sub boxShrink_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
Me.lboEmployees.Height = intItemHeight
Me.boxShrink.Height = intItemHeight + 100
End Sub
Private Sub lboEmployees_MouseMove(Button As Integer, Shift As Integer, X
As
Single, Y As Single)
Dim intItemCount As Integer
Dim dblMaxHeight As Double
intItemCount = Me.lboEmployees.ListCount
dblMaxHeight = intItemCount * intItemHeight
If Me.lboEmployees.Height <> dblMaxHeight Then
Me.lboEmployees.Height = dblMaxHeight
Me.boxShrink.Height = dblMaxHeight + 300
End If
End Sub
'==== end code =======