Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filters & Grids
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00396881
Message ID:
00396997
Views:
21
>>Hi Steve, I was using the SET FILTER command
>>
>>SELECT tblTrans
>>SET FILTER TO flddate >= dtFrom .AND. flddate <= dtTo
>>GO TOP
>>
>>in the Init method of the form. The date range was being entered into two textboxs in a previous form and passed to this form
>>
>>P.S. I also tried setting the data enviornment-cursor's filter property
>
>I'm going to guess that because the code was in the Init event of the form, that might be why it doesn't take. The form kinda exists in the netherworld until the .Init event completes. We've solved that dilemma by creating an .InitialSetup method that is blank in the form base class but populated with necessary code at the sub-classed form level. This method is automatically run through via the application object's .DoForm() method so we know it's always run. We limit any code in the .Init of all forms. This also lets the form display faster.
>

The real problem is that the variables used in the filter statement go out of scope when the Init finishes firing. To ensure that the values remain visible and in scope for the life of the form, store them in form properties and use the form properties rather than the variables, or convert them to literals so that the scope of the variable doesn't affect the visibility of the filter's FOR clause.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform