Access Change data type from Macro or Module

Hello

I have an access database that I need a macro or Module that will change the data type of 2 fields.

The table name is     starting1
and the 2 fields I need changed from TEXT to NUMBER are   LastName      and     Courses

Thanks for your help in advance.

FaithDan
LVL 1
FaithDanAsked:
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.

XGISCommented:
your changing lastname to number?

try creating two new fields of the type you need.
name them the same except add a 1 on the end
get the the table in datasheet view and copy the contents of old to new, assuming they are numbers
0
FaithDanAuthor Commented:
They are numbers in both fields.  This is from an import file and its a repeated task.

so I need code that I can run to perform this change as a repeated task.

Thanks

FaithDan
0
XGISCommented:
maybe get the fields to number before the import, eg in excel (avoid the default double type), then import the spreadsheet data as a temp table, the append the existing table..using an append query is that an option?
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

FaithDanAuthor Commented:
Hello

Module

FaithDan
0
XGISCommented:
what is the file type being imported, is it delimited?
does the starting1 table need to have its field types changed once only
then all imports are numbers?

er hello details...

change field types
l1

import xls
l2
0

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
FaithDanAuthor Commented:
Hello

I need a module  that can change the my 2 fields from text to number. (Yes the data in both of those are all numbers (no decimals))

Don't worry about the why

I need the Module for an automated process.  This is not just a 1 process thing... its daily.

that's why I need a module to do.

Thanks

FaithDan
0
FaithDanAuthor Commented:
ALTER TABLE starting1
 ALTER COLUMN LastName number



 as a SQL query in Access
0
XGISCommented:
If it is reading a file whose name does not change and is updated daily from one or more sources (eg users via web app  or ftp or is simply downloaded and replaced daily from an email) and is in a static folder and the process is to be automated it is important to know the type (eg txt, xls, xlsx, dbf) and how the values are separated (comma, tab, space). This would be coded into the module so it knows how to read the integers. If the frequency is daily and automated then it needs to be scheduled, eg database opens at a certain time, process starts, finishes and then closes automatically.  Does this sound right?
0
XGISCommented:
looks like your all over it!...thankyou for the points!
0
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
Microsoft Access

From novice to tech pro — start learning today.