Ok, I threw together a crude conversion function that may be
good enough for limited usage. It converts everything to
inches so you can format the result in whatever units you
want by using a simple expression.
Public Function ConvertToInches(strMeas As String) _
As Currency
Dim varUnits As Variant
Dim strExpr As String
Dim k As Integer
strExpr = strMeas
varUnits = Array(" feet", "ft", " foot", " ft", _
" inches", "", " inch", "", " in", "", _
"feet", "ft", "foot", "ft", "'", "ft", _
"inches", "", "inch", "", "in", "", """", "", _
" mm", "*.03937", " cm", "*.3937", _
" m", "*39.37", "mm", "*.03937", _
"cm", "*.3937", "m", "*39.37")
For k = 0 To UBound(varUnits) Step 2
strExpr = Replace(strExpr, varUnits(k), varUnits(k+1))
Next k
If strExpr Like "*ft*" Then 'needed to handle 12 1/2ft
strExpr = "(" & Replace(strExpr, "ft", ")*12")
End If
strExpr = Replace(strExpr, " ", "+")
ConvertToInches = Eval(strExpr)
End Function
If you need something more sophisticated, try searching the
web.
--
Marsh
MVP [MS Access]
We have to parse out the information from things like
12' 8", 12 2/3', 3.8m, 380cm. Unless specifying with check boxes or combo
boxes would be easier, I am open to both ideas. This function is really only
going to be needed in the beginning of the migration from excel to access,
becuase before nothing was standard so some items were referenced in standard
units and some in metric, but now everything is going to be in standard units
out to 3 decimals. This allows them since they know it as metric to have a
handy way of converting to the new format.