DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Change a field data type

  1. #1
    Kelly Guest

    Change a field data type


    Hi Guys,

    I hope somebody out there can help.

    I need to update the datatype of field in lots of database on mass. Can anybody
    provide me with some code that will allow this change. I tried the following
    but got an error because the object is read-only.

    Sub subChangeFieldDataType(sDatabaseFullPath, sTableName, sFieldName As String,
    iDataType As Integer)

    Dim dbs As Database

    Set dbs = OpenDatabase(sDatabaseFullPath)

    dbs.TableDefs(sTableName).Fields(sFieldName).Type = iDataType

    Set dbs = Nothing

    End Sub

    Thanks

    Kelly

  2. #2
    Paul Clement Guest

    Re: Change a field data type

    On 1 Feb 2002 08:03:48 -0800, "Kelly" <kelly.james@mlsaccociates.co.uk> wrote:


    Hi Guys,

    I hope somebody out there can help.

    I need to update the datatype of field in lots of database on mass. Can anybody
    provide me with some code that will allow this change. I tried the following
    but got an error because the object is read-only.

    Sub subChangeFieldDataType(sDatabaseFullPath, sTableName, sFieldName As String,
    iDataType As Integer)

    Dim dbs As Database

    Set dbs = OpenDatabase(sDatabaseFullPath)

    dbs.TableDefs(sTableName).Fields(sFieldName).Type = iDataType

    Set dbs = Nothing

    End Sub

    See if the following helps:

    HOWTO: Change the Datatype of a Field using Data Access Objects (DAO) (Q249682)
    http://support.microsoft.com/default...;EN-US;q249682


    Paul ~~~ pclement@ameritech.net
    Microsoft MVP (Visual Basic)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center