Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric overflow
Message
From
27/04/2006 05:33:41
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01116716
Message ID:
01117015
Views:
17
OK
I added the following code in my command:
on error do CurErrHandler with error()
I got a message 'No parameter statement is found' (error 1238).
How do I have to call the function?
Thanks
>
>function CurErrHandler
>lparameter tnErrorNum
>if not 'vfpevent.fll' $ lower(set('library'))
>	set library to vfpEvent.fll additive
>endif
>if m.tnErrorNum = 39 && Numeric overflow
>	local lnFields, lnI, lcAlias, lnRecord, lnResult
>	lcAlias = alias()
>	lnFields = afields(laFields,m.lcAlias) && assuming the table is opened
>	lnRecord = recno(m.lcAlias)
>	for lnI=1 to m.lnFields
>		if inlist(laFields[m.lnI,2],'N','I','B','Y','F') and ;
>				"*" $ transform(evaluate(m.lcAlias+"."+laFields[m.lnI,1])) && This is a field, which gave an error
>			lnResult =  EventMBox('Field '+ laFields[m.lnI,1]+" would be blanked because of numeric overflow "+ ;
>				chr(13)+"on the record "+transform(m.lnRecord)+" in file "+dbf(m.lcAlias)+ ;
>				chr(13)+"Do you want to continue the appending process?", ;
>				MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON1, ;
>				"Error is encountered!", ;
>				"&Proceed", ;
>				"&Stop", "")
>			blank field (laFields[m.lnI,1])
>			pnNumberOfProblems = m.pnNumberOfProblems + 1 && Increment number of problems
>
>			if m.lnResult = IDNO && Stop
>				plHalt = .t. && Stop the process
>			endif
>		endif
>	next
>	return
>else
>	error m.tnErrorNum && produce an error and handle it by normal error Handler
>endif
>
>From some of my prev. life applications <g>
>
>I'm cc-ing the thread's originator.
>
>
>>>Hi
>>>Can I tell vfp: when you want to give me the error message 'Numeric overflow' (error 39), fill the field with 0 (in all of the code without adding the line if between(field.value,-9999,99999999) for each case).
>>>Thanks
>>
>>ERROR 39
>>
>>See Error command in Help.
Thank you
Chaim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform