Results 1 to 4 of 4
  1. #1
    Gareth Keenan is offline Novice
    Windows 2K Access 2007
    Join Date
    Sep 2011
    Posts
    2

    issue changing datatype in table

    Ahoj!

    I'm have a problem I need help with(duh.) My database consists of one large table of approx 3.9m rows and about 12 different columns. One of my columns is of a data type "date/time" but i need the format of this column to be "text"

    The problem is that when I right click the table/go to design view/ and try to change the data type, I get the error "Microsoft Access can't change the data type. There isn't enough disk space or memory."

    Which means i can't take the easy way out. Is there a way I can just create a new identical table and change the data type of my one column? I was thinking there might be something in SQL I could do, or some how in creating an identical table where only the field type has changed. I should note, I looked up this using the access in file help, and it appears the ALTER TABLE SQL will not work on my machine.

    I'm really at a loss, because the dataset was created from a txt file which as been lost to the ether, and I can't import the database into excel using a macro I didn't write unless the format of my column is text.



    Any suggestions?

    Cheers,

    Gareth Keenan

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The second easiest way out might be to export a query rather than the table. In the query, for that field, use the Format() function to format the date/time as desired. The Format() function returns text, so Excel should see it as text.

    Not sure why ALTER TABLE wouldn't work, other than it might return that same error. I have 2007 on a machine and ALTER TABLE works fine on it. You could probably do the identical table bit and use an append query to copy the data over after changing the data type of that field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Gareth Keenan is offline Novice
    Windows 2K Access 2007
    Join Date
    Sep 2011
    Posts
    2
    Solution found.

    For one field, I just created a new field(with the correct data type) and populated the new field with an update query to be equal to the field I wanted. Then delete the old column and rename the new column.

    What I'm actually in the process of doing is exporting the table to a text file, then re-importing and renaming all of the fields the correct data type.

    I didn't know I could export to a text file, but if you right click on the table you can export.

    Problem solved.

    Thanks for chiming in pbaldy!

    Gareth Keenan

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Glad you got it working, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. datatype mismatch in criteria expression
    By CyberSkillsz in forum Access
    Replies: 1
    Last Post: 06-14-2011, 10:56 AM
  2. Binary datatype
    By huBelial in forum Access
    Replies: 1
    Last Post: 04-04-2011, 02:02 PM
  3. confusing datatype error issue
    By TheShabz in forum Queries
    Replies: 5
    Last Post: 10-11-2010, 05:14 PM
  4. Changing table names from lowercase to uppercase
    By supernix in forum Database Design
    Replies: 1
    Last Post: 09-03-2010, 10:08 PM
  5. Master list table with changing values.
    By evander in forum Database Design
    Replies: 11
    Last Post: 06-24-2010, 07:40 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