alter more than one field at once access 2007

Posted on 2011-02-21
Last Modified: 2012-06-27
how can i alter more than one field in access 2007
 i need to change a fields in a table with number instead of text

example :
table1 , field1:TEXT filed2:TEXT
i need to alter table 1 changing field1 to NUMBER and field2 to NUMBER
Question by:drtopserv
LVL 77

Expert Comment

ID: 34942178
Don't really see the issue here.
What is stopping you changing the datatype?

Accepted Solution

jaiminpsoni earned 125 total points
ID: 34942261
You can not do it in a single statement, you need to run multiple statements...

ALTER TABLE <TableName> ALTER COLUMN <ColumnName> <Datatype>
LVL 77

Expert Comment

ID: 34942293
I didn't see anything in the Q that says this must be done in code - is that what you meant drtopserv?
To me, it just looked like  case of opening the table in design view and doing the changes.
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.


Author Comment

ID: 34942301
in data definition in the query ... should i write >? :
ALTER TABLE <TableName1> ALTER COLUMN <ColumnName1> <Datatype>
ALTER TABLE <TableName2> ALTER COLUMN <ColumnName2> <Datatype>
ALTER TABLE <TableName3> ALTER COLUMN <ColumnName3> <Datatype>
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 125 total points
ID: 34942376
To expand a bit on what jaiminpsoni wrote:

You'd have to issue individaul commands for EACH DDL query. You can't lump them together the way you can with other databses:

CurrentProject.Connection.Execute "ALTER TABLE <TableName1> ALTER COLUMN <ColumnName1> <Datatype> "
CurrentProject.Connection.Execute "ALTER TABLE <TableName2> ALTER COLUMN <ColumnName2> <Datatype> "
CurrentProject.Connection.Execute  "ALTER TABLE <TableName3> ALTER COLUMN <ColumnName3> <Datatype> "

Expert Comment

ID: 34942415
See if this helps....

Look at section....

Creating a Pass-Through Query and Creating a Data-Definition Query

See if that helps...

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question