Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Numeric overflow
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
01116716
Message ID:
01116730
Vues:
16
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.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform