Results 1 to 2 of 2
  1. #1
    jscriptor09 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    60

    access 2010 vba question

    Hi folks

    I am importing a excel 2007 spreadsheet into my DB.
    The spreadsheet has 4 columns that are Date type.


    After the import is completed, I checked the data type in Access 2010 for this particular table and these 4 fiels have Text datatype.

    As a result, when I tried to use the table along with another table for a query (linking dates), I get type mismatch from the query.

    I tried to do Docmd.runSQL "alter table ....." to change the field type using SQL DDL, but that ended up deleting all the imported date.

    I am really stumped here as I can't figure out how to set the field type to Date/Time with Short Date Format at run run time using VBA.

    Many thanks for any help/example on how to do this.

    Mike

  2. #2
    jscriptor09 is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    60
    Got it ...
    DOCMD.RunSQL "ALTER TABLETableName ALTER COLUMN [Col Name] DATETIME"

    I was missing the ALTER COLUMN

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

Similar Threads

  1. Change Access 2003 mdb workgroup using Access 2010
    By metsmaniac in forum Security
    Replies: 6
    Last Post: 04-06-2012, 08:56 PM
  2. Replies: 9
    Last Post: 08-07-2011, 11:21 AM
  3. Replies: 17
    Last Post: 08-03-2011, 05:19 PM
  4. ACCESS 2010 vba question
    By jscriptor09 in forum Access
    Replies: 1
    Last Post: 07-26-2011, 03:55 PM
  5. Migrating from 2003 to 2010 question
    By MikeD in forum Access
    Replies: 1
    Last Post: 03-04-2011, 08:48 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