Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I past parameter from a form variable to View 3

Status
Not open for further replies.

richrichrich

Programmer
Sep 9, 2004
13
US
I am new to using views. I created a view in DBC and would like to accept a input variable in a form as parameter and then will try to REQUERY() to the records that me tthe condition.

Let say I have a field in the view call "status" and will accept "THISFORM.mstatus.VALUE" as parameter. What should I need to do in the "Filter" tab in the view?

Thanks!
 
On the Filter tab page use the ?VariableName

* --- Desired Variable Named: mcThisParam

MyDBF.Field >= ?mcThisParam

Good Luck,
JRB-Bldr
 
Thanks JRB-Bldr but I don't want the "Pop-up" to prompt me to enter the variable. The View should take the variable in the form. Can this be done?

Thanks a lot!

 
Mark your view as NODATAONLOAD in the form's dataenvironment and feed it the parameter whenever you're ready

boyd.gif

 
RichRichRich,

In the filter tab of the view designer, insert the name of the form property (including the preceding THISFORM.), preceded by a question mark. Something like this:

?THISFORM.Status

Provided you open the view from a method of the form, you won't see the popup prompt.

In general, the prompt will only appear if VFP can't find the variable or property that you specify for the parameter.

If the value of the property is not available when the form is loading, do as Craig suggested and set the NoDataOnLoad property of the cursor (in the data environment) to .T. That will give you an initially empty view, which you can later populate by means of REQUERY().

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
" I don't want the "Pop-up" to prompt me to enter the variable"

The Pop-up will not appear if the variable is already defined and available to the View at the time it is Opened. It (the Pop-up) will only appear if the variable has not been defined.

Therefore if you have set up the View Filter as suggested above and then do something like:
Code:
mcThisParam = "This Value"

OPEN DATABASE MyDBC
USE MyView IN 0  && Where your MyView Filter is  MyView.Field >= ?mcThisParam

The View will open as desired.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top