Results 1 to 4 of 4
  1. #1
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199

    How to define field types in a make table

    Hello,



    Does anyone know how I can define all of my field types as text in a Make Table query? I want to overwrite the inherited type, which sometimes is a number.

    SELECT [My Table].* INTO [My Table 2]
    FROM [My Table];
    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    if you want a string, CSTR([field])
    CLNG([field]) ,long
    CINT([field]), integer
    ...

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If the table structure and field formats are known ahead of time, what I like to do is create a blank table shell, where I have pre-defined all the fields and data types, and other rules or formats I may want. I then use an Append Query instead of a Make Table Query to write the data to this table structure.

    If it is something I need to re-use, I just create a one-line macro to delete the existing data out of the table before each use, i.e.
    choose the RunSQL Action, and use the code:
    Code:
    DELETE [MyTableName].* FROM [MyTableName];

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    I would suggest NOT using make table, but rather an append query, to a table that already has the fields defined.

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

Similar Threads

  1. Replies: 1
    Last Post: 01-28-2015, 05:13 PM
  2. Cannot define field more than once
    By btk10 in forum Access
    Replies: 1
    Last Post: 10-23-2013, 08:15 PM
  3. Change Data Types in a Make Table Query
    By nyneave in forum Queries
    Replies: 1
    Last Post: 09-18-2012, 11:46 PM
  4. Defining Field Types In A Make Table Query
    By jo15765 in forum Queries
    Replies: 2
    Last Post: 05-23-2012, 08:07 PM
  5. Field Types for a Linked Table
    By Jeff_J in forum Access
    Replies: 9
    Last Post: 05-05-2009, 07:12 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