Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Programmatically change a field of number type to text type

Discussion in 'Information Technology' started by GVR_Mike, Jul 28, 2006.

  1. GVR_Mike

    GVR_Mike
    Expand Collapse
    Guest

    What's the easiest way to change a field of Number type to Text type
    programmatically?
     
  2. Loading...


  3. Allen Browne

    Allen Browne
    Expand Collapse
    Guest

    Assuming Access 2000 or later, you can execute a DDL query statement to
    change the field type.

    This example changes a field named MyField in a table named MyTable to a
    Text field with the Field Size set to 100:

    strSql = "ALTER TABLE [MyTable] ALTER COLUMN [MyField] TEXT(100);"
    DBEngine(0)(0).Execute strSql, dbFailOnError

    For more info on the names to use for the various field types compared to
    what they are called in table design, see:
    Field type names (JET, DDL, DAO and ADOX)
    at:
    http://allenbrowne.com/ser-49.html

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "GVR_Mike" <mjbruesch@triad.rr.com> wrote in message
    news:1150165974.837613.180980@i40g2000cwc.googlegroups.com...
    > What's the easiest way to change a field of Number type to Text type
    > programmatically?
     

Share This Page