Can't select from list box

L

laavista

I’m using Access 2003. I have a list box (called ListRecruiters) in the
detail section of the form. The list box displays the correct values, but
it does not allow anything to be selected.

Row source is: SELECT DISTINCT t_MilitaryBase.Recruiter FROM
t_MilitaryBase UNION select "All" from t_MilitaryBase;

Row Source Type: Table/Query
Bound Column 1
Allow value list edits No (I’ve tried yes)
Inherit value list no
Show only row source value no
Enabled yes
Locked no

The values in the list box are correct so I’m assuming the row source is OK.
When a command button is clicked, I call a procedure. (The command button
works and it does call the procedure.) Part of it follows:

Dim strIN As String


Set MyDB = CurrentDb()

strSQL = "SELECT * FROM t_MilitaryBase"

'Build the IN string by looping through the listbox
For i = 0 To ListRecruiters.ListCount - 1
If ListRecruiters.Selected(i) Then
If ListRecruiters.Column(0, i) = "All" Then
flgSelectAll = True
End If
strIN = strIN & "'" & ListRecruiters.Column(0, i) & "',"
End If
Next i

Your help would be greatly appreciated!
 
K

Ken Snell [MVP]

What is the Control Source of the listbox?
What is the Allow Edits property of the form?
 
L

laavista

You are amazing. The control source of the listbox was empty, but the
"allow edits" on the form was a "no". When I changed the allow edits on the
form to "yes", everything worked.

Ken, THANK YOU, for taking the time out of your busy schedule to help!!!
 

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