Table fieldType change at runtime

I have an access table, at RUNTIME in delphi I want to change the type of from numeric to Tekst or from tekst to numeric, is that possible?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why don't you try to store the value from this field into the desired type of data.

  MyNum : real;
  MyStr : string;
   MyNum := StrToFloat(MyDataSet.FieldByName(<YourField>).AsString);
   MyStr := FloatToStr(MyDataSet.FieldByName(<YourField>).AsFloat);

Hope this helps,
check out IntToStr and StrToInt
RodyAuthor Commented:
People, I know that all, but I want to change the type of fiels in the database, because of the following problem:

I have mdb file and I am working with, after that I have to download the nieuw version of mdb from an ftp site, and I have to work with the nieuw mdb. the local old file that I have has an autonumeric field, and the table that I am downloading has that field as Numeric, do u understaand the problem???
Thats why I want to change that field type from Nummeric to auto nummeric...
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

I don't think that the field type can be changed at Runtime. Or better - I didn't see or try that yet.

But if you have some data in that database you could save them to some arrays, then create whole new DB with new field definitions and then save the data in arrays back.

However, you sholdn't be very satisfied with this solution if there will be some BLOB (or MEMO or something like that) data saved there.
You must do the following:

1. Unload the table (possibly you can rename it)
2. Create the replacement table
3. Load the new table with the old data

Access does this internally if you try to do it in their designer, they just hide all of that from you.  

If you need a generic mechanism then I suggest a medeval torture device - to convince your data modeller that he should figure out the final format real fast.  :o)

As an alternative, say if your data modeller is much bigger and faster than you are, you can rename the old table, construct the new one, and then copy the data from one to the other using the query "insert into NewTable select * from OldTable".

Since access allows you to link across databases, the old table can simply be linked into the new database and the query will work just fine.

I wouldn't use arrays because arrays aren't large enough to satisfy the potential for a database.  
Since your real problem was numeric to autonumber, this should work okay.

For text to numeric and the converse, you would list the individual columns and cast the values in the query.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RodyAuthor Commented:
Thanks for the tip
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.