Combo box will not show value.

  • Thread starter Thread starter manis
  • Start date Start date
M

manis

Guest
I have the following code attached to "mouse down" on a combo box. The code works just fine. All the values are available in the list. However, when I select a value, the combo box will not show it! why?!

The code
Private Sub List_Reports_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim obj As AccessObject
Dim dbs As Object

Set dbs = Application.CurrentProject
For Each obj In dbs.AllReports
If UCase(Mid(obj.Name, 1, 6)) = "REPORT" Then
List_Reports.AddItem (obj.Name)
End If
Next obj
End Sub
 
I'd guess the properties of the listbox weren't set right. Check the Rowsource, see that it is set on 'List of values'. Also check the 'List Only' setting, maybe that one causes it.

What is the recordsource for your form, is it an editable one? What is the controlsource of your list? Does it's type allow the values in the list?

Also, consider putting your code in the form-load part of your form. Maybe the fact that the list is empty until you click on it causes the problem?

Greetz,

Seth
 
It worked!

I tried the code in "got focus". It works fine.
Thanks for your help.
 
That also was an option indeed!

Glad you figured it out :-)

Seth
 

Users who are viewing this thread

Back
Top Bottom