Hi,
Two problems caught my attention: first) you're using reserved VFP Word DESC(ending). You should change this field name to something like descrip. The second problem in your second SQL. You're trying to group by a field, which doesn't exist in your SQL. That's why you're having an error.
>Hey David!
>
>I had posted my problem about the profit loss program, which I think will be included in this post. Thank you so much for your help!! However, I am running into a problem which I have been trying to work out. When I do the PADR, I seem to be not bringing over the description in conjuction with the groupcode. The description remains the same for all the groupcodes. So let me show you what I have, and I will also show you what I am doing with the drag and drop records. Maybe you could shed some light on my procedure:
>
>TABLES USED:
>
>Report1 (print_order N(3), desc C(50), groupcode N(3), gl_code N(3), total N(12,2), I_L C(1)
>Reportnames (names C(50), groupcode N(3)
>
>WHAT CURRENT GRID LOOKS LIKE: (Right-click method on Print_Order)
>
>PRINT_ORDER DESCRIPTION GL_CODE TOTAL
>1 DVD Income 410 50,000
>2 DVD Loss 510 10,000
>3 GROSS DVD Income X 40,000
>4 VHS Income 420 50,000
>5 VHS Loss 520 60,000
>6 GROSS VHS Income X -10,000
>
>______________________________________________________
>
>
>I created the table that would hold a groupcode description and did your suggested PADR:
>
>SELECT PADR(Reportnames.Name + " TOTAL",25) AS Desc, ;
> " " AS Gl_code, ;
> IIF(I_L = "I",Total,Total*-1) AS Total, ;
> Groupcode, ;
> "X" AS I_L ;
> FROM Report1 ;
> GROUP BY Groupcode ;
> ORDER BY I_L ;
> INTO CURSOR SummaryTable
>
>RESULTS: (NOT WHAT I EXPECTED - AS YOU CAN SEE THE DESCRIPTION REMAINS THE SAME, AND THE GROUPCODE HAS DIFFERENT VALUES AS NEEDED.)
>
>DESCRIPTION CODE AMOUNT groupcode I_L
>
>DVD TOTAL 40000 10 X
>DVD TOTAL -10000 20 X
>
>THEN:
>
>SELECT Desc, Gl_Code, Total, GroupCode, I_L ;
> FROM Report1;
>UNION SELECT Desc, Gl_Code, Total, GroupCode, I_L ;
> FROM SummaryTable ;
> ORDER BY Groupcode, I_X ;
> INTO CURSOR DisplayTable
>
>BLOWS AN ERROR: SQL-ORDER BY clause is invaild
>
>So I do not know if you can shed any light on something that I may be doing wrong. I do want to share that I have an idea as to how to move these records, but I am running into the problem of getting the system to reorder correctly:
>
>Right click on the print_order of the one you want to move. The system changes the print_order number of that record to -1. A form asks you what is the new number you wish it to be (say 5). I have a seek for the actual record that says 5. I think if I were to change it to a 6 instead of a 0 and then increment all print_order < 6 with a + 1 that it may work. I just keep on gaining a number. I gave up the drag and drop because all it did was completely replace the number opposed to reordering and renumbering.
>
>Thank you once again for all your help, and I do hope that you will be able to assist me with this.
If it's not broken, fix it until it is.
My Blog