Update Query changing text to number

G

Guest

I am running an update query that is updating text to CLng. I receive a
message that all the records weren't updated due to a type conversion
failure. All of the records did change into a number, but I can't perform
numerical operations on them (add, subtract, etc.) What am I doing wrong?
Thanks
 
T

Tom Ellison

Dear Shark:

If you convert the values to long integers, then store them in a string
datatype, then they will be converted to strings when stored. You cannot
then operate on them as numbers. The database must respect the datatypes
defined in your table. If, instead, you make this column a long integer
type, then the values will be stored as long integers, even if the value
being stored is a string. Try it!

Tom Ellison
 
F

fredg

What is the field type in the table which is updated?

Linda

The datatype of the field is still text even though you tried to
convert the data to Number.

In table design view, you need to change the datatype of the field
from Text to Number.
 
V

Van T. Dinh

An Update Query can only change the data in the Table, not *structure* of
the Table.

If the values in the current Field can be converted to Long, simply open the
Table in design view and change the Field type to Number and Field size to
Long.
 

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