If the formula I suggested works fine, why bother with this convoluted
concatenation? Go with simple things whenever possible.
The problem with your concatenation expression is in your Mid function. You
don't tell the expression how many characters to get from the middle of the
string, so it finds the second character after the first X and then gets the
rest of the string, and then it concatenates your second "mm X" string, and
then it concatenates the string from the Right.
In order to use your expression, you'll need more complicated expression
that has to figure out how many numeric characters are between the first X
and the second X.
This expression should do what you seek (did not test it), but if you wanted
to add a fourth dimension, then the expression becomes even more complex.
Trim(Left([WoodSize], InStr([WoodSize], "X") - 1)) & "mm X " &
Trim(Mid([WoodSize], InStr([WoodSize], "X") + 2, InStrRev([WoodSize], "X") -
InStr([WoodSize], "X") + 2)) & "mm X " & Trim(Mid([WoodSize],
InStrRev([WoodSize], "X") +2)) & "mm")
See why it's better to use simple expressions? < g >
--
Ken Snell
<MS ACCESS MVP>
kennykee said:
Ken,
The formula given is good but can you help me to correct my expression:
20 X 30 X 50 ==> 20mm X 30mm X 50mm
I think the "Right" Part wrong
Left([WoodSize], InStr([WoodSize], "X") - 2) & "mm X " & Mid([WoodSize],
InStr([WoodSize], "X") + 2) & "mm X " & Right([WoodSize],
InStr([WoodSize],
"X") - 2) & "mm")
Thanks
Kennykee
Ken Snell said:
MyNewString = Replace(MyOldString, " X", "mm X", _
1, -1, vbTextCompare) & "mm"
--
Ken Snell
<MS ACCESS MVP>
I got two text box namely [text1] and [text2]
when i type==> 22 X 33 X 52 (a Measurement) in [text1]
automatically [text2] become 22mm X 33mm X 52mm
In short, i want to know code that add the letter "mm"
Instr(left.............)
I know how to do for two number but not 3 number.
Any solutions?
Thanks in advance
Kennykee