Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Date Filter on Form doesn't work properly
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01461572
Message ID:
01461597
Views:
69
Oops! Yeah, it was returning an empty date. Even after cleaning this up and buiilding the compelte dates, I am now getting another error when I hit the COMMAND, "SKIP", which is the result of my hitting a navigational button called NEXT. The error says, "dThru not found". dThru is one of the variables used in the date range of the filter. Ugh! What is going on with this? Why does SKIP produce an error?
WITH ThisForm
	IF .IsChanged()
		.SaveIt()
	ENDIF
	IF EOF()
		GO BOTTOM
		.bottomButton.Enabled = .F.
		.nextButton.Enabled = .F.
	ELSE
		SKIP
		IF BOF()
...more code
New SetDateFilter Method's code:
WITH ThisForm
	IF NOT EMPTY(.txtDateFrom.Value) AND ;
			NOT EMPTY(.txtDateThru.Value)
		* Build the From Date.
		cFrom      = .txtDateFrom.Value
		cFromMonth = LEFT(cFrom, 2)
		cFromDate  = SUBSTR(cFrom, 3, 2)
		cFromYear  = RIGHT(cFrom, 4)
		dFrom      = CTOD(cFromMonth + "/" + cFromDate + "/" + cFromYear)
		SET STEP ON
		* Build the Thru Date.
		cThru      = .txtDateThru.Value
		cThruMonth = LEFT(cThru, 2)
		cThruDate  = SUBSTR(cThru, 3, 2)
		cThruYear  = RIGHT(cThru, 4)
		dThru      = CTOD(cThruMonth + "/" + cThruDate + "/" + cThruYear)
		SELECT Quotes
		SET FILTER TO BETWEEN(Quotes.dQuote, dFrom, dThru)
		GO TOP
		.Refresh()
	ENDIF
ENDWITH
>Did you check values in dFrom and dThru? CTOD() will return empty date if it cannot convert the parameter passed to a date.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform