Solved

alter more than one field at once access 2007

Posted on 2011-02-21
6
348 Views
Last Modified: 2012-06-27
Hi,
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
0
Comment
Question by:drtopserv
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 34942178
Don't really see the issue here.
What is stopping you changing the datatype?
0
 
LVL 5

Accepted Solution

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

http://msdn.microsoft.com/en-us/library/bb177883(v=office.12).aspx

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

Expert Comment

by:peter57r
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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:drtopserv
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>
0
 
LVL 85

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> "
0
 
LVL 5

Expert Comment

by:jaiminpsoni
ID: 34942415
See if this helps....

http://www.ehow.com/how_13580_create-sql-query.html

Look at section....

Creating a Pass-Through Query and Creating a Data-Definition Query
http://www.ehow.com/how_13580_create-sql-query.html#ixzz1Eb76s3kR

See if that helps...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

726 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