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

Cannot Append from one Cursor file 1

Status
Not open for further replies.

crewchiefpro6

Programmer
Mar 22, 2005
204
US
I have a sql to cursor that works great but when I try to append the cursors to a regular dbf only one will work, the other one appends only blank records.

Here are the select statements, can someone point out what stupid thing I am doing wrong with the second select.

Please note that both contain correct records in a browse statement right after they are populated, it is just that the append fails on the second cursor.

I have verified that the structure is exactly the same on both. The only difference with the second cursor is the field headings have an A after the regular headings.


SELECT TOP 250 * ;
FROM csrAnswer ;
WHERE csrAnswer.iquarter >= csrAnswer.idialin ;
ORDER BY iquarter ;
GROUP BY carnumber ;
INTO CURSOR csrqualifying NOFILTER

*!* WAIT WIND "Top " + STR(_TALLY)

*!* IF _TALLY > 0
*!* **Browse Normal NoCaption
*!* ENDIF


SELECT TOP 250 * ;
FROM csrAnswer, csrqualifying ;
WHERE csrAnswer.carnumber NOT IN(SELECT carnumber FROM csrqualifying) ;
.AND. csrAnswer.iquarter < csrAnswer.idialin ;
ORDER BY csrAnswer.iquarter DESC ;
GROUP BY csrAnswer.carnumber ;
INTO CURSOR csrQualifyingBottom READWRITE

browse normal
** this shows correct information

IF USED("bottom")
SELECT BOTTOM
ELSE
SELECT 0
USE BOTTOM
ENDIF

ZAP

**** now assemble both cursors into one dbf so I can see the qualifying positions
APPEND FROM DBF("csrQualifying")
APPEND FROM DBF("csrQualifyingBottom")
Browse Normal NoCaption



Don Higgins
 
The only difference with the second cursor is the field headings have an A after the regular headings.

They're appearing because you're selecting all the fields from both csrAnswer and csrQualifying and Fox is appending the "A" to avoid duplicate field names. You need compatible structures for an APPEND to work. Try specifying the field names explicitly insetad of using SELECT *.

Geoff Franklin
 
You are correct, I only checked the structure to the last field that I expected, did not realize there were more fields with b on the end at the bottom.

Thank You.


Don Higgins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top