Help!! How to evaluate a Math function in string form

message from JM on 2 Jun 2004
Hi,

str = "(3)^2 + 23"

How can I evaluate str??

Thanks,

Jaime
 
Van T. Dinh replied to JM on 2 Jun 2004
strInput = "(3)^2 + 23"
?Eval(strInput)
32

HTH
Van T. Dinh
MVP (Access)

math function is in
 
Albert D. Kallal replied to JM on 2 Jun 2004
Try pasting the following code into a module..and then just whack f5 when
your cursor is in the code

Sub t1()

Dim strEx As String

strEx = InputBox("enter expression")

If strEx <> "" Then
MsgBox "the result of " & strEx & " is " & vbCrLf & _
Eval(strEx)

End If

End Sub

When the above runs...simply enter your expression of:

(3)^2 + 23
 

Archived message: Help!! How to evaluate a Math function in string form (MS Access)