Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Sep 2002
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    change the property of a field (Access 2000)

    I am renaming the fields in a table:
    tdf.Fields("F1").Name = "Students"
    My question is, how can i change the property of the field, since it is a text,and i want to make it number.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: change the property of a field (Access 2000)

    You cannot change a field's data type using the TableDef and Field objects. But you can do it using SQL:

    Dim db As DAO.Database
    Set db = ...
    db.Execute "ALTER TABLE MyTable ALTER COLUMN F1 INTEGER", dbFailOnError
    ' If you opened an external databas, close it
    db.Close
    Set db = Nothing

  3. #3
    Star Lounger
    Join Date
    Sep 2002
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: change the property of a field (Access 2000)

    Thank Hans !!

  4. #4
    Star Lounger
    Join Date
    Sep 2002
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: change the property of a field (Access 2000)

    I have appliied it successfully ! Now then, how can i change to currency? It sesm that db currency is not right


    db.Execute "ALTER TABLE MyTable ALTER COLUMN F2 dbcurrency", dbFailOnError

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: change the property of a field (Access 2000)

    The string is a SQL statement, not a DAO statement, so you must use the SQL word for a currency field, not the DAO word. This word is MONEY.

    db.Execute "ALTER TABLE MyTable ALTER COLUMN F2 MONEY", dbFailOnError

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •