Combo result is text when should be numeric

  • Thread starter Thread starter Lester Lane
  • Start date Start date
L

Lester Lane

Hi, I've never had this before but I notice when stepping through my
code that a combo that returns the AutoNumber ID field (numeric in the
table) is holding it as a string. Why? How has this happened? I
have not converted it in the query that is the record source. Using
Access 2003. Thanks in advance.
 
All values in controls are held as text representations.
What problem is this causing you?
 
If the combo is bound to a numeric field (including AutoNumber), its Value
will be numeric.

If the combo is unbound, but the Bound column is the AutoNumber, set its
Format property to something numeric (e.g. General Number), and Access will
treat is as numeric.

If the AutoNumber is not the bound column of the combo, the value is treated
as text. You can typecast it, e.g.:
Val(Nz([Combo1], 0))
 
If the combo is bound to a numeric field (including AutoNumber), its Value
will be numeric.

If the combo is unbound, but the Bound column is the AutoNumber, set its
Format property to something numeric (e.g. General Number), and Access will
treat is as numeric.

If the AutoNumber is not the bound column of the combo, the value is treated
as text. You can typecast it, e.g.:
    Val(Nz([Combo1], 0))

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


Hi, I've never had this before but I notice when stepping through my
code that a combo that returns the AutoNumber ID field (numeric in the
table) is holding it as a string.  Why?  How has this happened?  I
have not converted it in the query that is the record source.  Using
Access 2003.  Thanks in advance.

That explains it! Thanks, mine were unbound. A simple format to
Standard 0 dec places and left justify to get what I want - a numeric
value. The problem was in code when trying to see if two fields were
equal. But it works now! PS This never was the case in Access 2000.
 
Back
Top