A2000: unbound listbox selection not possible

A

Andrea Hahn

Hello,

I want to use a listbox in one form to navigate records in another form
after double-click on one listbox entry. The listbox RowSource is being
populated with a SELECT-statement in VB code "OnCurrent", since the content
is context dependent. After selection, I intend to use the
control.ItemData(rowindex) property to get the key I need for navigating
within the second form. But now I am stuck at an unexpected point before
even getting round to that: I cannot select an item from the listbox, and I
don't quite understand why. The listbox is enabled and is not locked.
Multiselect is set to "simple". It shows the rows I populated it with, but I
cannot click on an individual row (it does not change to white-on-black as I
would expect it to do). Using the space bar, the first row gets selected,
but the first one only. What am I doing wrong here?

Thanks for any ideas,
Andrea
 
J

John Viescas

If the list box has a Control Source, then you cannot set MultiSelect to
anything but None. The list box must be unbound - is it?

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
A

Andrea Hahn

Yes, the list box is unbound, but I nevertheless changed MultiSelect back to
"None" since actually I only want a user to select exactly one and not
several (my mistake, I misunderstood the purpose of MultiSelect="Simple" for
"Single"). It appears that the reason for not being able to select any entry
was that the Forms "Allow Edits"-property was set to "No". Setting it to Yes
did the trick (though I do not quite understand why selecting a row from an
unbound listbox qualifies as editing)?

Thanks,
Andrea
 
R

Rick Brandt

Andrea Hahn said:
Yes, the list box is unbound, but I nevertheless changed MultiSelect back to
"None" since actually I only want a user to select exactly one and not
several (my mistake, I misunderstood the purpose of MultiSelect="Simple" for
"Single"). It appears that the reason for not being able to select any entry
was that the Forms "Allow Edits"-property was set to "No". Setting it to Yes
did the trick (though I do not quite understand why selecting a row from an
unbound listbox qualifies as editing)?

Technically, the property AllowEdits is for the Form and not the RecordSet so it
makes sense when viewed in that light. It would be very handy however, if it only
applied to bound controls.
 

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