Re: getting single selected value from listbox



The combo is bound to a stored procedure but I only wish to obtain the value
of a selected record in the bound field. So for my listboxes an example is
below, listbox1 would return Model2 and Listbox 2 would return Product 3 and
listbox3 would return Product3,Opt1,Data1,Data2,Data3 where the comma
seperation indicate data items bound to seperate field within the stored
procedure.

Listbox1
Model1
Model2 (this is selected item)
Model3
etc...

Listbox2
Model1,Product1
Model1,Product2
Model1,Product3 (this is the selected item)
Model2,Product1
Model2,Product2
etc..

Listbox3
Product3,Opt1,Data1,Data2,Data3 (this is the selected item)
Product3,Opt2,Data1,Data2,Data3
etc...

"Jeff Boyce" wrote:

I believe I understand what you are saying. I don't know enough yet about
how your listboxes are set up to give you an answer.

Again, are you saying you want the first field THAT IS DISPLAYED in the row
selected, or the first (bound) field in the selected row? These are not the
same.

What are the SQL statements for the source of listbox2 and listbox3?

Which columns are bound in each? What are the field widths in each?

Regards

Jeff Boyce
Microsoft Office/Access MVP

"smarty" <smarty@xxxxxxxxxxxxx> wrote in message
news:75803C76-57F1-4DE3-81A9-25AB2A21C437@xxxxxxxxxxxxxxxx
Listbox1 has a single field value that I would like to retrieve and
Listbox2
and 3 have multiple fields 2 and 5 respectively. I would only like to
retrive the first selected field for listbox2 and the entire selected row
for
listbox3.

Hope this is enough info.

"Jeff Boyce" wrote:

Please re-read my previous response.

A listbox with, say, 4 fields displayed can have 17 fields, with a width
of
"0" for all but 4 of them. Typically, the first field is used to hold
the
rowID from the underlying source table/query, but its width is set to 0
so
it doesn't show/confuse the user. Typically, the first visible field is
the
one that contains the user-friendly text.

You haven't indicated which you are trying to retrieve.

Regards

Jeff Boyce
Microsoft Office/Access MVP

"smarty" <smarty@xxxxxxxxxxxxx> wrote in message
news:5096D1B0-93FE-4BB3-8C7C-B72B2E471B1A@xxxxxxxxxxxxxxxx
I have a form form1 which lauches another popup form form2. form2 has a
number of listboxes with thier row source bound to stored procedures to
populate them. Once the user has selected the company (listbox1),
location
(listbox2) and contact (listbox3) I wish to return the selected values
to
textboxes in form1.

I can't seem to find the listbox method that gives me the selected
value
from the listbox. I am not allowing multiple value selection so should
only
need to return a single value.

"Jeff Boyce" wrote:

Are you trying to retrieve the bound value of the selected row in the
listbox, or the displayed value (these don't have to be the same, and
seldom
are)?

You don't provide much to go on ... what have you been trying? What
happens
(?error message, Access quits, ???)?

More specific information will lead to more specific suggestions...

Regards

Jeff Boyce
Microsoft Office/Access MVP

"smarty" <smarty@xxxxxxxxxxxxx> wrote in message
news:F8B87DB2-5C71-4821-99A0-29999ED526FC@xxxxxxxxxxxxxxxx
Hi,

I have been trying to get the selected value returned from a
listbox.
Any
idea how to do it?









.



Relevant Pages

  • Re: Problem creating form that selects tables and fields
    ... "Jeff Boyce" wrote: ... command buttons, and an underlying table that holds the "picked" items. ... I'll typically allow only a single selection (i.e., ... through the listbox, finding the ItemSelected (and you could use ...
    (microsoft.public.access.formscoding)
  • Re: getting single selected value from listbox
    ... Microsoft Office/Access MVP ... but me.listbox3 only returns the first selected value of the listbox row ... "Jeff Boyce" wrote: ... I am not allowing multiple value selection ...
    (microsoft.public.access.forms)
  • Re: getting single selected value from listbox
    ... Microsoft Office/Access MVP ... but me.listbox3 only returns the first selected value of the listbox row ... "Jeff Boyce" wrote: ... I am not allowing multiple value selection ...
    (microsoft.public.access.forms)
  • Re: getting single selected value from listbox
    ... Microsoft Office/Access MVP ... "Jeff Boyce" wrote: ... I can't seem to find the listbox method that gives me the selected ... I am not allowing multiple value selection so ...
    (microsoft.public.access.forms)
  • Re: getting single selected value from listbox
    ... simple method just to return a value from a listbox, just give me a clue what ... "Jeff Boyce" wrote: ... Microsoft Office/Access MVP ... I am not allowing multiple value selection so ...
    (microsoft.public.access.forms)