combobox - number format

57otto

New member
Local time
Today, 10:51
Joined
Jun 25, 2006
Messages
7
I have been confronted with a strange fenomenon in comboboxes.

I'm working with access2000.
I put a simple combobox in a form.
The row source of the combobox is a table and the first field of this table is a number.
The bound column is 1.
When I select a record in the combobox, that number appears, it all seems to work.

However, when I reference the content of the combobox via a query, I receive strange characters.
When I ask for the ASCII value of that character, it is mostly 49 (1) or 50(2).
When I set the column width to zero, the references just work fine.
When I change the format to text, everything works fine.

Can someone explain why this is happening?

I include a simple database to show what is happening.
Look at the queries.

otto
 

Attachments

Otto,

this is not I a strange fenomenon, it's how combo's work.
I'm not sure what you're after but here's some advices.

You need to define primary keys on all your tables.
Use an autonumber colimn to reflect your primary keys.

You should define relationships between your tables.

Base your queries on tables.

I suggest you do get yourself a bit more familiar with Access first.
Have a look at the Northwind sample database and have a look at these sites:

http://www.functionx.com/

http://office.webforums.nl/forum/viewtopic.php?highlight=cursus&t=921

RV
 
Sorry,
I don't think I'm a beginner in Access. I'm quite used to create Access applications since more than 5 years and I have a university degree in computer science.
The sites you are referring to, are well known to me.

If you say "this is how a combobox works", then I would like to show me where it is documented that the data you can read from a combobox on a form do not correspond with the displayed data.
I would realle be grateful for that.

I'm just interested to know. I didn't have any trouble to find a workaround, but I remain wondering how access internally works.

thanks for your reaction anyway.

otto
 
I don't think I'm a beginner in Access.

I figured you were as your table definitions and structure tells me so ;)
Anyway, I had a look at your sample.
Could you explain your problem a bit more as I can't see any.

RV
 
Open Form1
Then have a careful look at queries Q_form1a and Q_form1b
and you will see what I mean.
I had expected that the value of the combobox would have been the value in the combobox display.
I'm really curious where this comes from.

otto
 
I had expected that the value of the combobox would have been the value in the combobox display.

It is.
Run Q_form1a.
It comes up asking you to enter a parameter Forms!Form1!vormbeheer plus a parameter Forms!Form1!vormbeheer0.
For both parameters, enter 2.

Query result looks fine to me.
So what's your problem?

RV
 
dear RV,

Thank you for continuing the discussion. I see it is not so simple to explain things by mail.

Like you said, nothing wrong with the query itself.

I first take the form Form1.
For both comboxes I take the first value in the list. This is not important.

Then I run Q_form1a.
The result is in Q_form1a.gif

Next I run Q_form1b.
The result is in Q_form1b.gif

The first combobox has the value CHR(50), while the display value is 2,
which 2 is also the value in the table.
The second combobox has the value chr(50), while the display value is 22, which 22 is also the value in the table.

When I try to get the value of the combox it gives me chr(50) which doesn't correspond to the real values (2 or 22).

I hope you can see this also.

otto
 
Excuse me, I forgot the attachments.

otto
 

Attachments

  • Q_form1a.GIF
    Q_form1a.GIF
    2.4 KB · Views: 143
  • Q_form1b.GIF
    Q_form1b.GIF
    1.9 KB · Views: 125
OK, I can see what your problem is.
You get the square character rather then the number.

Works fine for me.
I can't tell you what's happening on your side.
Perhaps somebody else can.

RV
 
I'm using the dutch version of access. This could be the reason.
The best workaround is using the eval function.

Thanks for answering

otto
 

Attachments

Users who are viewing this thread

Back
Top Bottom