Avatar of N P
 asked on

Visual Foxpro syntax error while saving code scan/endscan statement

I am trying to insert values  into a readwrite cursor TempCRSpop1 while using scan/endscan reading from another cursor TempCRS2, but I keep getting a syntax error while trying save the code.  What am I doing wrong with my syntax?  Sample code below:

Any help appreciated or if there is a better way to populate data into TempCRSpop1.

Best Regards, 


*I create my TempCRSpop1 readwrite cursor

Open in new window

SELECT O_ord_pay.op_main_key, O_ord_pay.op_sub_key,;
  O_ord_pay.op_ord_date, Req_payment.r_paiddate as op_date_paid, O_ord_pay.op_reqno,;
  O_ord_pay.op_vendor, O_ord_pay.op_desc, O_ord_pay.op_est_amt,;
  Req_payment.r_payamt as op_amt, O_ord_pay.op_po_no;
 FROM  dbbudget!o_ord_pay INNER JOIN dbbudget!req_payment ;
   ON  O_ord_pay.op_uniqueid = Req_payment.r_id;
 WHERE O_ord_pay.op_flag_1 = 1;
   AND Req_payment.r_paiddate BETWEEN .txtfdate.value AND .txttdate.value ;
   AND O_ord_pay.op_programs == alltrim(.cboprog.displayvalue) ;

*create another cursor called TempCRS2

SELECT O_ord_pay.op_main_key, O_ord_pay.op_sub_key,;
  O_ord_pay.op_ord_date, O_ord_pay.op_date_paid, O_ord_pay.op_reqno,;
  O_ord_pay.op_vendor, O_ord_pay.op_desc, O_ord_pay.op_est_amt,;
  O_ord_pay.op_amt, O_ord_pay.op_po_no;
 FROM dbbudget!o_ord_pay;
 WHERE O_ord_pay.op_flag_1 = 3;
   AND O_ord_pay.op_date_paid BETWEEN .txtfdate.value AND .txttdate.value ;
   AND O_ord_pay.op_programs == alltrim(.cboprog.value) ;
   OR (O_ord_pay.op_flag_1 BETWEEN 6 AND 10;
   AND O_ord_pay.op_date_paid BETWEEN .txtfdate.value AND .txttdate.value ;
   AND O_ord_pay.op_programs == alltrim(.cboprog.value)) ;
   OR (O_ord_pay.op_flag_1 = 2 ;
   AND O_ord_pay.op_ord_date BETWEEN .txtfdate.value AND .txttdate.value ;
   AND O_ord_pay.op_programs == alltrim(.cboprog.value)) ;  

*finally, I'm trying to scan through my TempCRS2 cursor and insert the values into *TempCRSpop1 cursor that I created primarily, but I keep getting syntax errors when *saving my code.

      INSERT INTO ('TempCRSpop1') (O_ord_pay.op_main_key, O_ord_pay.op_sub_key,;
                            O_ord_pay.op_ord_date, O_ord_pay.op_date_paid,;
                            O_ord_pay.op_reqno, O_ord_pay.op_vendor,;
                            O_ord_pay.op_desc, O_ord_pay.op_est_amt,;
                            O_ord_pay.op_amt, O_ord_pay.op_po_no);
         VALUES (TempCRS2.op_main_key, TempCRS2.op_sub_key, TempCRS2.op_ord_date,;
               TempCRS2.op_date_paid, TempCRS2.op_reqno,;
               TempCRS2.op_vendor, TempCRS2.op_desc,;
               TempCRS2.op_est_amt, TempCRS2.op_amt,;

*the following error is what I get and can't figure out why:

FoxPro* VFP

Avatar of undefined
Last Comment
Pavel Celba

8/22/2022 - Mon
Pavel Celba

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes