Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AC Dr. Watson problem with Wizard

Status
Not open for further replies.

Jasonic

Technical User
Jun 20, 2001
69
GB
I have created the following wizard

<----------------------- CUT HERE
{ GLOBAL =
Function amRoundUp(ByVal dNum as Double) as Double
Dim lErr as Long
Dim holeNo as String, Digit as String, Remain as String, twoDigit as String
Dim dNumber as Double

holeNo = LeftPart(CStr(dNum),&quot;.&quot;,0)

Remain = RightPartFromLeft(CStr(dNum),&quot;.&quot;,0)

Digit = Mid(Remain,3,1)

twoDigit = Mid(Remain,1,2)

If Digit > 4 Then
dNumber = CDbl(holeNo &&quot;.&quot;& twoDigit) + 0.01
Else
dNumber = CDbl(holeNo &&quot;.&quot;& twoDigit)
End If

amRoundUp(dNumber)

End Function
}
NAME = &quot;Wizard&quot;
VERSION = &quot;2354&quot;
{ PAGE PAGE1
{ NUMBOX NUMBOX1
FORMAT = &quot;double&quot;
MINVALUE = &quot;0&quot;
VALUE = &quot;0&quot;
}
{ COMMANDBUTTON COMMANDBUTTON1
CAPTION = &quot;Round&quot;
{ CLICK =
Dim lErr as Long

lErr = AmSetProperty(&quot;numbox2&quot;,amRoundUp({numbox1}))
}
{ ENABLED =
If {numbox1} <> 0.00 Then
RetVal = 1
Else
RetVal = 0
End If
}
}
{ NUMBOX NUMBOX2
FORMAT = &quot;Double&quot;
VALUE = &quot;0&quot;
}
}

{ FINISH FINISH
}

<----------------------- END CUT

Everytime I run this simple wizard, Dr Watson pops up. Anyone got any ideas how to fix this or implement a function that rounds double values to 2 decimal places? Jason Thomas
AssetCenter Consultant
:)
 
Jason,

Try checking the last line in your amRoundUp function.

What you are doing here is calling the function recursively instead of returning back from it. Therefore AssetCenter will bomb out (most probably with a stack overflow).

Change the line to amRoundUp = dNumber


-------------------
Mark Edwards
Consultant
Infrasolve Ltd.
e: mark.edwards@infrasolve.com
-----------------
 
Cheers

what an idiot, obviously to busy with lots of other task to look at it properly! ::) Jason Thomas
AssetCenter Consultant
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top