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

How to use a form text box value in a SELECT statement

Status
Not open for further replies.

hallm

Programmer
Jun 11, 2000
159
US
I've got a form that has a text box that stores the date and a command button that's set up to create an export file of the data thats on the screen (the current record). I'm having trouble getting the SELECT statement to work. Here's what I have so far:

SELECT "D0" + employeepay.ssn, employeepay.employeename, " " + employeepay.employeesalary, employeepay.employeecont, " ";
FROM mers!employeepay;
WHERE employeepay.paydate = THISFORM.PAYDATEVAR.Value;
ORDER BY employeepay.employeename;
INTO CURSOR temp
SELECT temp
COPY TO mers.txt TYPE SDF

This creates the file, but once I added the WHERE clause it only shows the first date in my database, not the correct date. Any suggestions?


Thanks,


Marion Hall
 
You cannot have a "this" or "Thisform" in an SQL statement.

Try:
Code:
Local dValue
dValue = THISFORM.PAYDATEVAR.Value
SELECT "D0" + employeepay.ssn, employeepay.employeename, "     " + employeepay.employeesalary, employeepay.employeecont, "     ";
FROM mers!employeepay;
WHERE employeepay.paydate = dValue;
ORDER BY employeepay.employeename;
INTO CURSOR temp
SELECT temp
COPY TO mers.txt TYPE SDF



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top