querying specific information

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lions1855
    New Member
    • May 2010
    • 3

    #1

    querying specific information

    This is the code for extracting from a memo the weight of each product.
    Code:
    Shipping (Package) Weight: Mid([Technical],InStr(1,[Technical],"kg [",1)+2,Len([Technical])-(InStr(1,[Technical]," lb]",1)-9))
    However, for some reason, and I'm no expert. The code is not extracting just the weight. it keeps pulling other information.

    [0.07 lb]
    Product Width: 26.00 mm [1.02 in]
    Battery Type: Alkaline
    Voltage: DC 4.5V

    Can anyone help?

    I don't need Product width, Battery type and/or voltage
    Last edited by NeoPa; May 4 '10, 02:01 PM. Reason: Please use the [CODE] tags provided.
  • MikeTheBike
    Recognized Expert Contributor
    • Jun 2007
    • 640

    #2
    Hi

    I could be missing something, but would this do it?
    Code:
    Shipping (Package) Weight: Mid([Technical],InStr(1,[Technical],"kg [",1)+2,(InStr(1,[Technical]," lb]",1)+3)-(InStr(1,[Technical],"kg [",1)+2))
    Or somethink like it !

    MTB
    Last edited by NeoPa; May 4 '10, 02:01 PM. Reason: Please use the [CODE] tags provided.

    Comment

    • lions1855
      New Member
      • May 2010
      • 3

      #3
      It works! Thank You! Thank You!

      Now...Its still showing a single bracket in front of the pounds. How do I remove this as well?

      [0.07 lb

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        Try changing the +2s to +4s :
        Code:
        Shipping (Package) Weight:
          Mid([Technical],InStr(1,[Technical],'kg [',1)+4,(
          InStr(1,[Technical],' lb]',1)+3)-(
          InStr(1,[Technical],'kg [',1)+4))
        I've added lines for display purposes. You can remove these to use in your database.

        Comment

        • lions1855
          New Member
          • May 2010
          • 3

          #5
          Hi,

          that works, too, as well.

          If a product does not have a weight, can the script by pass the item, and move to the next one?

          Thanks

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            Yes. Use IIf() in your formula.

            Comment

            Working...