This is the other part of the export file that I'm working on. For some reason the text file that is created only has the first record duplicated. It doesn't list all the records for a certain date. The code was posted in answer to one of my posts in the VFP Forms forum and just used a SELECT tablename statement before the SCAN command. I origanlly tried putting the SELECT statement there, but I was getting errors so then I moved it to the top of the code and saved results into a cursor, but I still can't get it to give me all of the results for a certain date.
What am I doing wrong?
Thanks,
Marion
dValue = THISFORM.paydatevar.Value
SELECT employeepay.ssn, employeepay.employeename, employeepay.employeesalary, employeepay.employeecont;
FROM mers!employeepay;
WHERE employeepay.paydate = dValue;
ORDER BY employeepay.employeename;
INTO CURSOR temp
lcFileName = "test.TXT"
l_nHandle = FCREATE(lcFileName, 0)
IF l_nHandle < 0
*l_cOpenerror = LUFE(FERROR())
l_cOpenerror = "Please Try Something Else"
messagebox("Error Creating MEDCERT file."+;
CHR(13)+l_cOpenerror, d_nOkbutton+d_nStopsign, "Export Data")
RETURN
ENDIF && l_nHandle < 0
SELECT temp
lnMyRecCnt = 0
SCAN
lcBuffer = ""
* kills leading '0's for candidate ID's
lcBuffer = lcBuffer + "D" && 1
lcBuffer = lcBuffer + "0" && 2
lcBuffer = lcBuffer + employeepay.ssn && 3-11
lcBuffer = lcBuffer + employeepay.employeename && 12-35
lcBuffer = lcBuffer + " " && 36-39
lcBuffer = lcBuffer + employeepay.employeesalary && 40-48
lcBuffer = lcBuffer + employeepay.employeecont && 49-57
lcBuffer = lcBuffer + " " && 58-66
lcBuffer = lcBuffer + "City of Many" && 67-80
=FPUTS(l_nHandle, lcBuffer) && Write with CRLF
lnMyRecCnt = lnMyRecCnt + 1
ENDSCAN &&*
= FCLOSE(l_nHandle)
What am I doing wrong?
Thanks,
Marion
dValue = THISFORM.paydatevar.Value
SELECT employeepay.ssn, employeepay.employeename, employeepay.employeesalary, employeepay.employeecont;
FROM mers!employeepay;
WHERE employeepay.paydate = dValue;
ORDER BY employeepay.employeename;
INTO CURSOR temp
lcFileName = "test.TXT"
l_nHandle = FCREATE(lcFileName, 0)
IF l_nHandle < 0
*l_cOpenerror = LUFE(FERROR())
l_cOpenerror = "Please Try Something Else"
messagebox("Error Creating MEDCERT file."+;
CHR(13)+l_cOpenerror, d_nOkbutton+d_nStopsign, "Export Data")
RETURN
ENDIF && l_nHandle < 0
SELECT temp
lnMyRecCnt = 0
SCAN
lcBuffer = ""
* kills leading '0's for candidate ID's
lcBuffer = lcBuffer + "D" && 1
lcBuffer = lcBuffer + "0" && 2
lcBuffer = lcBuffer + employeepay.ssn && 3-11
lcBuffer = lcBuffer + employeepay.employeename && 12-35
lcBuffer = lcBuffer + " " && 36-39
lcBuffer = lcBuffer + employeepay.employeesalary && 40-48
lcBuffer = lcBuffer + employeepay.employeecont && 49-57
lcBuffer = lcBuffer + " " && 58-66
lcBuffer = lcBuffer + "City of Many" && 67-80
=FPUTS(l_nHandle, lcBuffer) && Write with CRLF
lnMyRecCnt = lnMyRecCnt + 1
ENDSCAN &&*
= FCLOSE(l_nHandle)