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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter query?

Status
Not open for further replies.

GaryWilsonCPA

Technical User
Jul 19, 2000
253
US
In crystal and in access there is a function called parameter query that allows a user to respond to a question such as "date range" or "Customer Number"

I am building a form that applies payments to services - I want my users to pick a client and have the list of services of that client show. from there they can apply the payment to the service.

In access I can use a bound parameter query to do the above. I dont see any thing called parameter query in foxpro - is there another name for this?
 
Yes, it's a parameterized query or view. Just put a question mark in front of the variable on the right side of the WHERE clause, and if the variable isn't currently defined, VFP will prompt for a value. e.g.
Code:
SELECT * from mycustomers ;
  WHERE custname=?pickcust ;
  INTO cursor custrecs
Note: If you created your own form that got the custname value, and then set "pickcust" to this before executing this statement, then that value would be used and no prompt would be made.

Rick
 
Rick,

I don't know if you have this thread marked, but I am unable use the above code. Running the code generates an error dialog box with "SQL Column 'PICKCUST' is not found".

Any ideas?

Thanks,

Jacob Smith
 
Jacob,
You are correct, I was &quot;half&quot; right - this only works for views (not straight queries). Although it also works for queries in SQL Pass Through. I guess I was &quot;projecting&quot; too much into VFP's native capabilities (at least so far <g>).

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top