Results 1 to 3 of 3
  1. #1
    farssr is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2011
    Posts
    2

    Working with TableDefs

    Periodic upgrading of a database occasionally requires changing a field's datatype. I want to do this while preserving table content. Can I change field size with coding like this?



    Set tdfMyTable = dbsData.TableDefs!tblMyTable
    fld.Type dbLong
    tdfMyTable.Fields.Refresh

    The second statement gives an invalid operation error message.
    Any ideas? Thanks.

  2. #2
    farssr is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2011
    Posts
    2

    Red face Figured it out!

    I used the dbs.Execute command to run an ALTER TABLE statement that ALTERs the column type.

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    solved, marked.

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

Similar Threads

  1. VBA Code not working how it Should
    By Juan4412 in forum Programming
    Replies: 7
    Last Post: 12-07-2010, 01:59 PM
  2. TableDefs.Delete
    By DaveE in forum Programming
    Replies: 3
    Last Post: 10-31-2010, 07:19 PM
  3. help queries is not working
    By ahmed-aljawad in forum Queries
    Replies: 3
    Last Post: 04-16-2010, 12:14 PM
  4. 07 Switchbox Not Working! - please help
    By techexpressinc in forum Access
    Replies: 16
    Last Post: 05-05-2009, 09:36 AM
  5. Why isn't this working?
    By adiecidue in forum Queries
    Replies: 4
    Last Post: 04-27-2009, 10:29 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