title: Change a field type programatically using VBA Access 2007
body: <p>I have a routine that imports an Excel table, changes several column (field) names, adds an index and several new fields.  However, the indexed field imports from Excel as a Double and I would like to change it to Long.  This code snippet works all except for changing the type:</p>
  
  <pre><code>Set tdf = db.TableDefs(TableName) ' Modify the new MBDA List table
  For Each fld In tdf.Fields
      Select Case fld.Name ' Change the name of specific fields
          Case "MBDA Piece ID #"
              fld.Name = "MBDA Piece ID"
              fld.Type = dbLong ' change the type from Double to Long
          Case "&gt;&gt;Grade Level"
              fld.Name = "Grade"
          Case Else
      End Select
  Next fld
  NumFlds = i
  </code></pre>