Unique Values in Combo Box Form

B

bsawers

Hi

I'm new to Access, SQL, and databases. I've created a form and added a combo
box (unbound) and a text box (bound to a column in my TXILINE table called
WINGSPAN_FT). My combo box lists values from another column called IDLIN. The
problem is that the values listed from the column IDLIN arent distinct. For
example it lists L1, L1, L1 when I only want it to list L1 once. When I open
the properties for the combo box and go to Row Source my SQL looks like this:

SELECT DISTINCT TXILINE.MSLINK, TXILINE.IDLIN FROM TXILINE;

Even though I'm using SELECT DISTINCT it doesnt return unique values from
column IDLIN. Also, for whatever reason in order to populate my combo box
with values from IDLIN my sql needs to contain field MSLINK...When I delete
MSLINK from my sql...for example:

SELECT DISTINCT TXILINE.IDLIN FROM TXILINE;

no values are returned to my combo box...

Thanks for your help :)
 
K

KARL DEWEY

What do you get if you use
SELECT TXILINE.IDLIN FROM TXILINE GROUP BY TXILINE.IDLIN;
in a query?

bsawers said:
Hi Karl,

Thanks for your reply, I tried:

SELECT TXILINE.IDLIN FROM TXILINE GROUP BY TXILINE.IDLIN;

and the combo box on my form returned no values...I also tried:

SELECT TXILINE.MSLINK, TXILINE.IDLIN FROM TXILINE GROUP BY TXILINE.IDLIN;

seeing how for whatever reason I need to include the MSLINK field in my query
and i got a message saying "You tried to execute a query that does not
include the specified expressed 'MSLINK' as part of an aggregate function"...
Seeing that I tried another query including MSLINK in my GROUP BY:

SELECT TXILINE.MSLINK, TXILINE.IDLIN FROM TXILINE GROUP BY TXILINE.MSLINK,
TXILINE.IDLIN;

But all it did was populated my combo box with values which werent unique
again.



KARL said:
Try this -- UNTESTED
SELECT TXILINE.IDLIN FROM TXILINE GROUP BY TXILINE.IDLIN;
[quoted text clipped - 17 lines]
Thanks for your help :)
 
B

bsawers

If I just use a query it works fine...the problem is when I try and do it
using the form.

KARL said:
What do you get if you use
SELECT TXILINE.IDLIN FROM TXILINE GROUP BY TXILINE.IDLIN;
in a query?
[quoted text clipped - 25 lines]
 
B

bsawers

I just figured it out with a little help.

SELECT Min(MSLINK),IDLIN FROM TXILINE GROUP BY IDLIN


If I just use a query it works fine...the problem is when I try and do it
using the form.
What do you get if you use
SELECT TXILINE.IDLIN FROM TXILINE GROUP BY TXILINE.IDLIN;
[quoted text clipped - 5 lines]
 
B

bsawers

Now I have a combo box in a form which displays unique values from field
IDLIN.

I also have a textbox on the form which is bound to the column WINGSPAN_ID
and when a value is selected in the combo box (lets say L1 is selected) the
corresponding value in WINGSPAN_ID is displayed in the text box...

The user can edit the value of WINGSPAN_ID in the text box to whatever they
like...the problem is that it doesnt edit all values of L1, just one value...
I would like it to edit all values of L1. Thanks.


KARL said:
Why not use the query as the source?
If I just use a query it works fine...the problem is when I try and do it
using the form.
[quoted text clipped - 8 lines]
 
K

KARL DEWEY

I would like it to edit all values of L1.
Do you mean you want a single change to reflect in all records?

bsawers said:
Now I have a combo box in a form which displays unique values from field
IDLIN.

I also have a textbox on the form which is bound to the column WINGSPAN_ID
and when a value is selected in the combo box (lets say L1 is selected) the
corresponding value in WINGSPAN_ID is displayed in the text box...

The user can edit the value of WINGSPAN_ID in the text box to whatever they
like...the problem is that it doesnt edit all values of L1, just one value...
I would like it to edit all values of L1. Thanks.


KARL said:
Why not use the query as the source?
If I just use a query it works fine...the problem is when I try and do it
using the form.
[quoted text clipped - 8 lines]
Thanks for your help :)
 
B

bsawers

Yes I think so...so that when the user selects say L1 from the combo box, all
records in WINGSPAN_ID associated with L1 change.

KARL said:
Do you mean you want a single change to reflect in all records?
Now I have a combo box in a form which displays unique values from field
IDLIN.
[quoted text clipped - 14 lines]
 

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