The solutions can be used in a query as a calculated field or they can be used
on a form or report.
If you wanted to permanently change the data, you could try an update query.
Add a new field that is the proper datatype Number - Double (for instance)
Make sure you set the default for the field to blank unless you want a default
value of zero.
UPDATE YourTable
Set [TheNewField] = CDbl([TheOldField])
WHERE IsNumeric([TheOldField])
In the query grid (Design view)
Add your table
Add the new field
in a blank cell enter
IsNumeric([TheOldField])
Under that enter
TRUE
Select Query: Update from the menu
In the UPDATE TO cell under the new field enter
CDbl([TheOldField])
Select Query: Run from the menu
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
Floydene wrote:
> I did try changing the datatype and lost the data. (I'mworking in a test file
> first). Unfortunately, I am not comfortable in SQL - I'm presuming that the
> solutions you gave are for queries to change the data?
>
> Thank you,
>
>
>
> "John Spencer" wrote:
>
>> Permanent change or just change for purposes of calculation. Assuming that
>> the field may contain non-numeric data, use
>> IIF(IsNumeric([SomeField]),Val([SomeField]),Null)
>>
>> If the field is never null and always contains only numbers then you can use
>> one of the conversion functions
>> CDbl([SomeField])
>>
>> If you want to change the datatype permanently, you can try opening the table
>> and changing the datatype. BACKUP your data first, in case this goes wrong.
>>
>> John Spencer
>> Access MVP 2002-2005, 2007-2008
>> The Hilltop Institute
>> University of Maryland Baltimore County
>>
>> Floydene wrote:
>>> How can I (or can I) change an existing table field from text to numeric?
>>>
>>> I need to use the text field for some calculations. It is a large file and
>>> i'm using Access 2007.
>>>
>>>
>>> Thanks,
>>> Jennifer
|