Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Got a monthpicker control?
Message
From
29/01/2009 13:21:57
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01378182
Message ID:
01378202
Views:
13
>I still think you're trying to make it more complicated than it is. :)
>Each year has 12 month so there's nothing special about any year in that respect. IOW, there's no relationship between picking a month and picking a year.

...unless we mean to pick the months in which we have data (just something I was working on this week), in which case
	SELECT DISTINCT YEAR(d) AS nYear;
		,	MONTH(d) AS nMonth, CMONTH(d) AS cMo	;
		,	SPACE(24) AS cYM	;
		,	{} AS dfrom, {} AS dTo	;
		FROM crsWhereWeHaveDAsDateField;
		WHERE NOT EMPTY(d);
		INTO CURSOR crsByMonth READWRITE ;
		ORDER BY 1,2

	SCAN
		lcYM=cMo-STR(nYear,5,0)
		ld1=DATE(nYear, nMonth, 1)
		ld2=GOMONTH(ld1,1)-1
		REPLACE cYM WITH lcYM	;
			, dfrom WITH ld1	;
			, dTo WITH ld2
	ENDSCAN
...and then the string from the cYM column is fed to the combo, and the dFrom and dTo fields contain the first and last day of each month.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform