Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not the return value I expected
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00632457
Message ID:
00632463
Views:
12
This message has been marked as the solution to the initial question of the thread.
You didn't specify the field name in the textbox value assigment.
BTW, You don't need to compare result of 'Cdm30wrk.wrk_stat = "A-ACCTNG"' to the .t. because it's already logical value. There's also no need to ALLTRIM(Cdm30wrk.cmp_name) because foxpro compares the string on the left to the lenght of the string on the right.
SELECT SUM(Cdm30wrk.wrk_tlamt) AS LastYearSales;
 FROM  classicdb!cdm30wrk;
 WHERE Cdm30wrk.wrk_stat = "A-ACCTNG" ;
   AND Cdm30wrk.wrk_page = 1;
   AND Cdm30wrk.cmp_name = lcThisClient;
   AND YEAR(Cdm30wrk.date_updt) = ldLastYear;
into cursor curLastYearSales
thisform.pgfClientDetails.pagAccountDetails.txtLastYearSales.value = curLastYearSales.LastYearSales
>Please show me why this code returns what it does.
>
>local ldLastYear, lcThisClient, curLastYearSales
>
>***
>
>ldLastYear = YEAR(DATE()) - 1
>lcThisClient = thisform.cboClientName.Value
>
>
>SELECT SUM(Cdm30wrk.wrk_tlamt);
> FROM  classicdb!cdm30wrk;
> WHERE Cdm30wrk.wrk_stat = "A-ACCTNG" = .T.;
>   AND Cdm30wrk.wrk_page = 1;
>   AND ALLT(Cdm30wrk.cmp_name) = lcThisClient;
>   AND YEAR(Cdm30wrk.date_updt) = ldLastYear;
>into cursor curLastYearSales
>thisform.pgfClientDetails.pagAccountDetails.txtLastYearSales.value = curLastYearSales
>
>This code is in the init of the form. Optimistic locking, table buffered private data session.
>Instead of a currency amount I get F for any client I select on the form. I put a thisform.refresh in the LostFocus of the combo that selects the client to view.
>
>I tested the query (without form related variables) in the command window with a hard coded client selection and the query returned 1 record, a nice numerical amount. What is different? Is the Init the wrong place to place the code? Have I done something wacky with the assignments?
>
>Regards and TIA,
>Matthew
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform