Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Codes do not work in EXE
Message
From
20/09/2005 05:00:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
20/09/2005 04:18:39
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01051157
Message ID:
01051164
Views:
15
>Dear Experts
>
>Following codes work fine without Exe and do not work in EXE.
>What is wrong?
>Please help
>
>IF !empty(thisform.container3.text1.value)
>	b_date=thisform.container3.text1.value
>	thisform.container3.text3.value=cdow(thisform.container3.text1.value)
>
>	y_ears=0
>	IF !EMPTY(b_date)
>		IF b_date>DATE()
>			RETURN .f.
>		ENDIF
>
>		db=DAY(b_date)
>		mb=MONTH(b_date)
>		yb=YEAR(b_date)
>
>		dd=DAY(DATE())
>		MD=MONTH(DATE())
>		yd=YEAR(DATE())
>
>		y_ears=yd-yb
>		y_ears=IIF(mb>md,y_ears-1,IIF((mb=md) .and. (db>dd),y_ears-1,y_ears))
>		m_onths=md-mb
>
>		IF db>dd
>			m_onths=m_onths-1
>		ENDIF
>		IF m_onths<0
>			m_onths=m_onths+12
>		ENDIF
>
>		d_ays=dd-db
>
>		DO CASE
>		CASE INLIST(mb,1,3,5,7,8,10,12)
>			d_calc=31
>		CASE INLIST(mb,4,6,9,11)
>			d_calc=30
>
>		CASE mb=2
>			IF MOD(yb,400)=0
>				d_calc=29
>
>			ELSE
>				IF MOD(yb,100)=0
>					d_calc=28
>				ELSE
>					IF MOD(yb,4)=0
>						d_calc=29
>					ELSE
>						d_calc=28
>					ENDIF
>				ENDIF
>			ENDIF
>		ENDCASE
>
>		IF d_ays<0
>			d_ays=d_ays+d_calc
>		ENDIF
>	ENDIF
>
>	thisform.container3.text2.value=alltrim(str(d_ays))+;
>		+alltrim("-")+alltrim(str(m_onths))+alltrim("-")+;
>		alltrim(str(y_ears))
>ENDIF
>
>THISFORM.REFRESH
>
Tariq,
This code is already open to a failure. I don't think it's an IDE vs EXE thing.
Variables are not prefixed with m. It'd fail as soon as a table in current workarea has field(s) with the same name as variables.
Probably that's what you mean. Too much hardcoded. Create a function instead. Remove hardcoding, add typechecking...
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform