Type conversion question

linda sciallo

Registered User.
Local time
Today, 11:27
Joined
May 15, 2001
Messages
21
Can "0.01" be converted using the CDbl function??

If not, any suggestions on how to convert to text??

Thanks.
 
This is a numeric field that is being converted to
text field on the database.
 
If you put

Cstr([yourfield])

doesn´t that work?

Fuga.
 
Just realized something:

Is your question how to change the type of the field, rather than its contents?

If so, you do that by opening up table in design view and change the field type to text.

Fuga.
 
I have an amount that is a string field that contains the value 0.01 that I want to convert to numeric in the recordset. The convert statement I am using is as follows:

CDbl(Val(Replace(OldValue, ",", "")))

OldValue contains 0.01

The application abends with "key column error is insufficient or incorrect. Too many rows were affected by the update". Error -2147467259.

I was wondering if this abend was caused by the
type conversion of this field.
 
Sorry Linda but we're having trouble understanding what you want to do.

If you are trying to change the data type of the column in the table, open the table in design view and change it. If you have invalid data, it will be lost. A more complicated method is to create a new column to hold the numeric values and to run an append query to populate the column. You can then compare the two columns. Use a condition such as - Not (CDbl(YourOldColumn) = YourNewColumn) to identify the bad records.

If you simply want to convert the field to a double in a recordset, use a query that does the conversion -
Select CDbl(YourOldField) As YourNewField, ....
From ....
 

Users who are viewing this thread

Back
Top Bottom