Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jun 2012
    Thanked 0 Times in 0 Posts

    Access Update Query

    I need to do the following update to a field depending on its contents I will put the logic that needs to be applied below.

    If the first byte is NOT a 0 I need to add the 0 to the front of the string ex 2153 dg -> 02153 dg

    after this i need to do the same thing on the third byte ex 02152 dg -> 020152 dg

    the last thing i need to do is check the 9-10th bytes for characters, if no characters are present i need to input two letters
    ex. 0201528 -> 0201528 XX

    Im not sure if this can all be done in one update query or if i need to make 3 different ones. I'm not an expert with access, I wish I could just bypass a firewall and write a php script but this is not allowed.


  2. #2
    Join Date
    Jun 2010
    Thanked 1,412 Times in 1,228 Posts
    You can write a VBA function to do it, which you can call from a query. The function will take the field as an input value and should output the changed value, which you can then use in the SET clause.

Posting Permissions

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