>>>I use a parameterized view in a form and I have it in the data environment. Whenever I start the form the view prompts me for the parameter even though I set the value of the parameter.
>>>
>>>In the Init of the form I have:
>>>
>>>ld_sched = date()
>>>=requery("schedname")
>>>
>>>ld_sched is the parameter of the view.
>>>
>>>Below is the view definition. Ignore everything except the where clause with the parameter.
>>>
>>>SELECT Schedule.dialtime, Demogrph.name, Schedule.rfid, Schedule.rundate,;
>>> Schedule.nurse_clas, Schedule.pat_loc, Schedule.dial_loc, Schedule.hrs,;
>>> Schedule.dial_type, Schedule.pat_type, Schedule.sched_type,;
>>> Schedule.modality;
>>> FROM patdb!demogrph, patdb!schedule;
>>> WHERE Schedule.rfid = Demogrph.rfid;
>>> AND Schedule.rundate = ?ld_sched;
>>> ORDER BY Schedule.dialtime, Demogrph.name
>>>
>>>Why do I get prompted for the parameter?
>>
>>IN the DE, set the view's nodataonload Property to .T.
>
>Won't this simply delay the inevitable? I want to programatically set the parameter and not have the user input the value.
Evan,
The problem you're having is that VFP does the equivalent of a REQUERY() when it opens the view in the data environment. You get an error because the variable you set in the Init method is not available. By setting the NoDataOnLoad property to .T., you keep FoxPro from looking for the parameter until you do a REQUERY(). Because you set the value of the parameter before the REQUERY() in your Init, FoxPro won't prompt you for the parameter value.