Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006

    Question Unanswered: Change DataType Using Macro??

    Hello (I am new to the forum!!!)

    This is for my employer.

    Using Access 2003, I import a CSV file (using Specification Settings) that has a fixed text length of 10 char. (ex. " 7890")

    Right now, I am setting the datatype to "integer", that trims any spaces before the text.

    But, I have to convert it to text manually because of another table (that I join to) that uses this number as text.

    Q: Can I change the data type using a macro??

    I am automating the entire inporting process and need to do it using a macro or code.


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    consider leaving everything alone, but instead convert the number to a string in the join. not sure if it will work... no doubt Rudy will pull me up yet again if its wrong
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Nov 2006
    I figured a way to do it.

    I made another table called "Table1_Empty" that has the datatype change and run the macro this way.

    1) DeleteObject (Table1)
    2) CopyObject (copies Table1_Empty to Table1)
    3) TransferText (imports CSV file and copies to new Table1_Empty)

    Thats it!!


Posting Permissions

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