Changing source of the combo?

  • Thread starter Krzysztof Bartosiewicz
  • Start date
K

Krzysztof Bartosiewicz

Hi!
I have a little problem. I have a combo box with a source like that:

SELECT ConsultChoices.ID_CHOICE, ConsultChoices.ID_SIGN,
ConsultChoices.ChoiceName
FROM ConsultChoices;

The table ConsultChoices:
ID_CHOICE ChoiceName ID_SIGN
0 Option1 0
1 Option2 1
2 Option3 2
3 Option4 3
999 Option5 x

I set "999" as the default value. When I open the form everything is ok - I
can see "x" instead of "999". The problem is that when I select value "x" so
the value in the field is stored as "999" and I open the form again to show
the record the source changes to:

SELECT [ConsultChoices].[ID_CHOICE], [ConsultChoices].[ChoiceName] FROM
ConsultChoices;

and I see 999 as the value of the combo - I would like to see "x" :)

Do you have any idea why the source changes? I will be greateful for any
suggestions...

One more thing.. I probably cannot use text values. The whole idea is that
the client want to have to choose from 0, 1, 2, 3 and "x" but I have to sum
those values. Maybe it is possible to sum text values but I would rather use
numbers. When I used text values it was strange - if I summed up the fields
by simply typing "=field1+field2" as the source of a text field it the
result was OK if I summed numbers and returned "error" if there was "x"
value. However when I tried the same using a query in SQL it returned
concatenation of the strings so the sum of 1 and x was "1x" :)

Thanks in advance for any help
Chris
 
K

Klatuu

I am not really sure, because I have not seen how the properties for your
combo box are set up, but one thing look suspicious. Change your original
query to:

SELECT ConsultChoices.ID_CHOICE, ConsultChoices.ChoiceName,
ConsultChoices.ID_SIGN,
FROM ConsultChoices;

No logical reason, just one of the intuitive things.

I do wonder why you are using a table instead of just a list for so few
entries. Is it that there are many more and this is a sample? If this is
the complete list, consider changing to an entered list.
 
K

Krzysztof Bartosiewicz

U¿ytkownik "Klatuu said:
I am not really sure, because I have not seen how the properties for your
combo box are set up, but one thing look suspicious. Change your original
query to:

SELECT ConsultChoices.ID_CHOICE, ConsultChoices.ChoiceName,
ConsultChoices.ID_SIGN,
FROM ConsultChoices;

I am stupid stupid stupid ;) I forgot that I have two different forms
loaded - one for new entries and one for viewing old ones... So it was not
the problem with changing of the source but changing of a form...
I do wonder why you are using a table instead of just a list for so few
entries. Is it that there are many more and this is a sample? If this is
the complete list, consider changing to an entered list.

As for not using a list - the values in the combo might be changed by the
user and that's why they are in a separate table..

Thanks for help!
Chris
 

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