Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update a part of a string in code (Access 2003, XP

    I don't know if this is possible, but it'd be great if it was...

    I am running a project that relies on a fixed-width data string and can parse out various fields in code for examination using Mid(FieldNameDesired, startpoint, len). now I want to reverse the operation and write back to a copy of the string any changes to _just that section of the string_.

    This SQL doesn't work, and I'm not terribly surprised:

    UPDATE EditMDS_String SET MID(MDSRecord_Edit, 260, 2) = '01';

    Any ideas? I am trying to avoid re-writing the entire datastring as, 1) the fields we are extracting and operating on are a small % of the overall string and 2) any errors at all may be hard to detect or verify.

    TIA

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

    Re: Update a part of a string in code (Access 2003, XP

    You'll rewrite the entire value anyway in an update query - SQL doesn't have the notion of updating part of a field.

    So you'd use something like this:

    UPDATE EditMDS_String SET MDSRecord_Edit=Left([MDSRecord_Edit],259) & '01' & Mid([MDSRecord_Edit],262)

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update a part of a string in code (Access 2003

    muchas gracias! seems to be working. as usual, you make the clouds disperse and set the bluebirds a-warblin'

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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