ShaunMarion
asked on
coverting column type using code
Is there any way to change the column type at run time using code? I have a floating point column that I can convert to a currency type in design mode, however I want to do it at run time. I am going to email a system to several users, they are going to fill in some information and it is going to import some data. When it is done importing, I want it to automatically change the column name so I don't have to go over and do it for them.....is this possible?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here's the link to PAQ where you'll find code which uses above method to modify field type in runtime:
http://www1.experts-exchange.com/bin/Q.10325861
Paasky
http://www1.experts-exchange.com/bin/Q.10325861
Paasky
Why do you want to change the column type in the table?
What about using a query to change the type of the required field.
You may create the query using code, using the querydef object.
dim myq as queryDef
set myq = CurrentDb.CreateQueryDef(" query_1", "select CCur(ty.y1) as y1, ty.y2
query_1 can be set as the record source for a form or a report!
What about using a query to change the type of the required field.
You may create the query using code, using the querydef object.
dim myq as queryDef
set myq = CurrentDb.CreateQueryDef("
query_1 can be set as the record source for a form or a report!
Glad I was able to help you ShaunMarion. Good luck to your project!
Best regards,
paasky
Best regards,
paasky
1) Create a new column,
2) Transfer the data with a query (the fastest way) or a loop,
3) Delete the original column,
4) Create a new column of the type you want the data to be,
5) Copy back the data,
6) Then delete the temp field.
It probably would be better to change the data type on the way into the table than to get the data into the table then change it...
Brian