Solved

alter more than one field at once access 2007

Posted on 2011-02-21
6
345 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 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> "
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

734 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