Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003

    Post Unanswered: Manipulating Text Field

    Hi all,

    I have set up an access db that has a text field which needs the data re-ordering in it.

    There are over 400 records that have the following format:

    150 SEC - hfdsfhdsjkfhds
    (spaces exist)

    and I want the following format:

    SEC 150 - hfjdshfsk

    What is the easiest and quickest way of doing this? I've been looking at it for a view

    days now and have considered manually sorting it if I can't work it out soon!

  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    if your format is really
    "150 SEC - hfdsfhdsjkfhds" (i.e. 3char space 3char space Nchar)
    then the following will fix it:

    strNew = mid$(strOld,4,3) & " " & left$(strOld, 3) & " " & mid$(strOld,8)

    BUT the fact that you are trying to do this suggests that you shouldn't do it at all! clearly you & the originator of the string have different ideas about how the string should be formatted. if you send your new-format string back to the originator, he is going to have the same problem you have now.

    why not split the field into three fields, one holding mid$(strOld,4,3), the second holding left$(strOld, 3), and the third holding mid$(strOld,11).

    now you can format a string whenever you need it in your or the originator's format with no effort (bonus: you also save 4 bytes/record).


Posting Permissions

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