Results 1 to 6 of 6
  1. #1
    itm is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    69

    Trying to get an Alter table to work

    Hi,
    I have used this before but for some reason it is not working here. I used this with MS Access 2003 and maybe that has something to do with it, I do nto know; I am using 2007 here. However, I tring to change a text field to a number(double). It does not error or anything but it does not change it either.


    The code I am using is :

    Code:
    strSql = "ALTER TABLE [TempAging] ALTER COLUMN [ORDRNBRS] Number(Double)"
        cn.Execute strSql
    Any ideas would be really appreciated.
    Thank you
    itm

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Try the following.

    strSql = "ALTER TABLE [TempAging] ALTER COLUMN [ORDRNBRS] Double"

    You may have to delete the original text values (unsure, untested)

  3. #3
    itm is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    69
    Well thank you, but unfortunately that did not work.

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Did not work is not too helpful -- did you get an error?

    I tried a query on one of my tables.
    The Agency table had a field newfld that was Text.


    This works for me in Acc2003

    Sub testalter()

    Dim sql As String
    sql = "Alter table agency alter column newfld double;"
    CurrentDb.Execute sql
    End Sub

  5. #5
    itm is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    69
    Well as I said before I do not get any errors, it jsut does not work; but I think it is something to do with 2007, because it did work for mee too when I used to use 2003. That is oky I fugured out a work around. Thanks for trying.

  6. #6
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Well this is a forum for everyone to learn, so why not tell the current and future readers what you did for a work around.
    The info at the top of your post indicates you have 2003.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. alter table to add a column in a linked table
    By markjkubicki in forum Programming
    Replies: 6
    Last Post: 02-09-2012, 08:13 AM
  2. Alter Table syntax error
    By markjkubicki in forum Programming
    Replies: 1
    Last Post: 02-06-2012, 05:43 PM
  3. Access 2007--Alter table using vb.
    By bcofie in forum Access
    Replies: 1
    Last Post: 12-29-2011, 08:13 PM
  4. Alter table Yes/No field
    By Cojack in forum Queries
    Replies: 7
    Last Post: 10-27-2010, 11:31 AM
  5. Alter Views/Queries in MDB from C# application.
    By avadhutkhavare in forum Access
    Replies: 0
    Last Post: 11-03-2009, 04:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums