here ya go...tested with qb4.5

DECLARE FUNCTION ParseEq# (eq AS STRING)

DIM eq AS STRING

eq = "(10 ^(2*2))/20+( 90*4)*10+ (1+9)*88 +244 /866- 46^ 2-1"

PRINT (10 ^ (2 * 2)) / 20 + (90 * 4) * 10 + (1 + 9) * 88 + 244 / 866 - 46 ^ 2 - 1

PRINT ParseEq#(eq)

SLEEP

FUNCTION ParseEq# (eq AS STRING)

'holds the lowest math function found in the equation

'+or- 1=addition/subtraction 2=multiplication/division 3=power

DIM curLow AS INTEGER

curLow = 4

'location of the lowest math function in the string

DIM curInd AS INTEGER

'how many math operations are found in the equation

DIM numOfOps AS INTEGER

numOfOps = 0

'number of parentheses

DIM numOfPar AS INTEGER

numOfPar = 1

'filter spaces

FOR c = 1 TO LEN(eq)

IF MID$(eq, c, 1) = " " THEN eq = LEFT$(eq, c - 1) + RIGHT$(eq, LEN(eq) - c)

NEXT c

'get rid of parantheses if they include the whole equation 'ex (234+434*(23+1)) -> 234+434*(23+1)

IF LEFT$(eq, 1) = "(" AND RIGHT$(eq, 1) = ")" THEN

FOR c = 2 TO LEN(eq)

'if we find close or open parantheses, add or subract to the current open number

IF MID$(eq, c, 1) = ")" OR MID$(eq, c, 1) = "(" THEN numOfPar = numOfPar + (40 - ASC(MID$(eq, c, 1))) * 2 + 1

'if there are 0 parantheses open, then the opening and closing parantheses

'do not enclose the whole equation so we cannot remove them

IF numOfPar = 0 AND c <> LEN(eq) THEN EXIT FOR

'the opening and closing parantheses enclose the entire thing

'so we can safely remove them

IF numOfPar = 0 AND c = LEN(eq) THEN eq = MID$(eq, 2, LEN(eq) - 2)

NEXT

END IF

'find the lowest operator

FOR c = 1 TO LEN(eq)

'skip stuff inside parantheses in the operation count

IF MID$(eq, c, 1) = "(" THEN

numOfPar = 1

FOR tempc = c + 1 TO LEN(eq)

IF MID$(eq, tempc, 1) = ")" OR MID$(eq, tempc, 1) = "(" THEN numOfPar = numOfPar + (40 - ASC(MID$(eq, tempc, 1))) * 2 + 1

c = tempc + 1

IF numOfPar = 0 THEN EXIT FOR

NEXT

IF c = LEN(eq) + 1 THEN EXIT FOR'equation end has been reached

END IF

IF MID$(eq, c, 1) = "+" OR MID$(eq, c, 1) = "-" OR MID$(eq, c, 1) = "*" OR MID$(eq, c, 1) = "/" OR MID$(eq, c, 1) = "^" THEN numOfOps = numOfOps + 1

IF MID$(eq, c, 1) = "+" OR MID$(eq, c, 1) = "-" THEN '+,-

'make it either +1 or -1, addition or subtraction

curLow = 44 - ASC(MID$(eq, c, 1))

curInd = c

ELSEIF MID$(eq, c, 1) = "*" OR MID$(eq, c, 1) = "/" THEN '*,/

IF ABS(curLow) > 1 THEN

'make it either +2 or -2, mutliplication or division

curLow = -((ASC(MID$(eq, c, 1)) - 42) / 5 * 4 - 2)

curInd = c

END IF

ELSEIF MID$(eq, c, 1) = "^" THEN '^

IF ABS(curLow) > 2 THEN

'make it +3 for power function

curLow = 3

curInd = c

END IF

END IF

NEXT

'single number, no equation to evaluate!

IF numOfOps = 0 THEN ParseEq# = VAL(eq)

'addition or subtraction

IF ABS(curLow) = 1 THEN ParseEq# = ParseEq(LEFT$(eq, curInd - 1)) + ParseEq(RIGHT$(eq, LEN(eq) - curInd)) * curLow'split formula into two formulas, the split being at the lowest operation

'by multiplying the second clause by the number, if it is negative, it is converted to subtraction

'ie) 1+1 * -1 = 1-1

'multiplication or division

IF ABS(curLow) = 2 THEN ParseEq# = ParseEq(LEFT$(eq, curInd - 1)) * ParseEq(RIGHT$(eq, LEN(eq) - curInd)) ^ (curLow / 2)

'by taking the second clause to the number, if it is negative, it is converted to division

'ie 2* 2^-1 = 2 * 1/2 = 2/2

'power function

IF curLow = 3 THEN ParseEq# = ParseEq(LEFT$(eq, curInd - 1)) ^ ParseEq(RIGHT$(eq, LEN(eq) - curInd))

END FUNCTION

man its been a *long* time since ive used qb.....