PC Review


Reply
Thread Tools Rate Thread

Change in data type

 
 
Nicawette
Guest
Posts: n/a
 
      13th Nov 2006
Hi all,

I've a problem when I change the data type;
I've a table (+- 1'000'000,- records) where all the field are in text.

I want to change the data type in the field "amount" (sample : 7502.15)
from text to number but when I do that I've an error message saying
that " access encountered errors while converting the data) the content
of fields in +- 1'000'000,- records were deleted".

Do you know how to change the filed type without deleting my data ?

PS I want to do that because pivot table in excel will be based on this
DB and if the field "amount" is in text I can't sum all the data.

Thank you in advance.

Nicolas

 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      13th Nov 2006
How are you attempting to change the data type?

As an interim step, you could always create a query that uses the CSng, CDbl
or CCur function on your text fields to convert them, then use that query
rather than the table to create the pivot table.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Nicawette" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
>
> I've a problem when I change the data type;
> I've a table (+- 1'000'000,- records) where all the field are in text.
>
> I want to change the data type in the field "amount" (sample : 7502.15)
> from text to number but when I do that I've an error message saying
> that " access encountered errors while converting the data) the content
> of fields in +- 1'000'000,- records were deleted".
>
> Do you know how to change the filed type without deleting my data ?
>
> PS I want to do that because pivot table in excel will be based on this
> DB and if the field "amount" is in text I can't sum all the data.
>
> Thank you in advance.
>
> Nicolas
>



 
Reply With Quote
 
=?Utf-8?B?S0FSTCBERVdFWQ==?=
Guest
Posts: n/a
 
      13th Nov 2006
I would suggest adding a new field datatype Number, Single. Run an update
query updating the new field using data from the old text field. Then see
what does not convert and analyze to see why. Maybe some extra characters
like 2500+ or >3500.

"Nicawette" wrote:

> Hi all,
>
> I've a problem when I change the data type;
> I've a table (+- 1'000'000,- records) where all the field are in text.
>
> I want to change the data type in the field "amount" (sample : 7502.15)
> from text to number but when I do that I've an error message saying
> that " access encountered errors while converting the data) the content
> of fields in +- 1'000'000,- records were deleted".
>
> Do you know how to change the filed type without deleting my data ?
>
> PS I want to do that because pivot table in excel will be based on this
> DB and if the field "amount" is in text I can't sum all the data.
>
> Thank you in advance.
>
> Nicolas
>
>

 
Reply With Quote
 
=?Utf-8?B?VG9tIFdpY2tlcmF0aA==?=
Guest
Posts: n/a
 
      13th Nov 2006
Hi Nicolas,

One or more of your entries is likely text that cannot be converted to a
number. Try running the following query to discover the bad records:

SELECT [YourTableName].[YourFieldName]
FROM [YourTableName]
WHERE IsNumeric([YourFieldName])=0;

where you substitute YourTableName with the actual name of your table, and
YourFieldName with the actual name of your field (Amount, I believe). To use
this SQL statement, create a new query. Dismiss the Add Tables dialog without
adding any tables. In query design view, click on View > SQL View. You should
see the word SELECT highlighted. Copy the SQL statement shown above (Ctrl C)
and paste it into the SQL view (Ctrl V), replacing the SELECT keyword. You
can then switch back to the more familiar design view, if you wish, by
clicking on View > Design View. Run the query. If it returns any records,
then you need to make the appropriate correction.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/ex...tributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

"Nicawette" wrote:

> Hi all,
>
> I've a problem when I change the data type;
> I've a table (+- 1'000'000,- records) where all the field are in text.
>
> I want to change the data type in the field "amount" (sample : 7502.15)
> from text to number but when I do that I've an error message saying
> that " access encountered errors while converting the data) the content
> of fields in +- 1'000'000,- records were deleted".
>
> Do you know how to change the filed type without deleting my data ?
>
> PS I want to do that because pivot table in excel will be based on this
> DB and if the field "amount" is in text I can't sum all the data.
>
> Thank you in advance.
>
> Nicolas

 
Reply With Quote
 
Nicawette
Guest
Posts: n/a
 
      13th Nov 2006
Thank you all for your swift answers

nicolas

Tom Wickerath a écrit :

> Hi Nicolas,
>
> One or more of your entries is likely text that cannot be converted to a
> number. Try running the following query to discover the bad records:
>
> SELECT [YourTableName].[YourFieldName]
> FROM [YourTableName]
> WHERE IsNumeric([YourFieldName])=0;
>
> where you substitute YourTableName with the actual name of your table, and
> YourFieldName with the actual name of your field (Amount, I believe). To use
> this SQL statement, create a new query. Dismiss the Add Tables dialog without
> adding any tables. In query design view, click on View > SQL View. You should
> see the word SELECT highlighted. Copy the SQL statement shown above (CtrlC)
> and paste it into the SQL view (Ctrl V), replacing the SELECT keyword. You
> can then switch back to the more familiar design view, if you wish, by
> clicking on View > Design View. Run the query. If it returns any records,
> then you need to make the appropriate correction.
>
>
> Tom Wickerath
> Microsoft Access MVP
>
> http://www.access.qbuilt.com/html/ex...tributors.html
> http://www.access.qbuilt.com/html/search.html
> __________________________________________
>
> "Nicawette" wrote:
>
> > Hi all,
> >
> > I've a problem when I change the data type;
> > I've a table (+- 1'000'000,- records) where all the field are in text.
> >
> > I want to change the data type in the field "amount" (sample : 7502.15)
> > from text to number but when I do that I've an error message saying
> > that " access encountered errors while converting the data) the content
> > of fields in +- 1'000'000,- records were deleted".
> >
> > Do you know how to change the filed type without deleting my data ?
> >
> > PS I want to do that because pivot table in excel will be based on this
> > DB and if the field "amount" is in text I can't sum all the data.
> >
> > Thank you in advance.
> >
> > Nicolas


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change data in an Internal Data Type Blayne Willett Microsoft Outlook Form Programming 5 23rd Jul 2009 02:08 AM
Change data type Dimitris Nikolakakis Microsoft Access ADP SQL Server 2 26th Jun 2006 09:06 PM
Change Memo data type to Text data type DS Microsoft Access Getting Started 1 26th Jan 2005 04:56 PM
Unable to change data type in field options when importing data f. =?Utf-8?B?SmluTXF0?= Microsoft Access External Data 1 21st Jan 2005 10:58 PM
How to change a number or text data type to autonumber and keep the table data? Julian Ganoudis Microsoft Access Forms 2 12th Jan 2004 08:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:49 PM.