Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not the return value I expected
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00632457
Message ID:
00632645
Vues:
11
Before I left last night I placed this code in the Valid event for the combo for selecting the client and a THISFORM.REFRESH in the LostFocus. It got what I wanted. I was going to look at using the When of the combo this morning. I like the form method and had slipped a gear on using AS. Thanks for reminding me since the other piece of info I need on the form is YearToDateSales.

Regards,
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";
   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.sum_wrk_tlamt
>You can add a custom method to the form, put this code there and call from whenever you need. In
SELECT SUM(Cdm30wrk.wrk_tlamt) AS LastYearSales;
'AS LastYearSales' assigns the name to the column in select. This way you don't have to guess what name foxpro would assign to the calculated column. The array should work also. Can you post your new code?
>
>
>>browsed the cursor created and found that my field is sum_wrk_tlamt. thanks for pointing me in the right direction. I'm thinking now that it works that the init is not the best place for the code. Query runs when the form loads and pulls for the client where the record pointer was at the time. Changed client via the combo on the form but the query does not refresh. I'll look at that tomorrow.
>>
>>Thanks
Opportunity is missed by most people beacuse it is dressed in overalls, and looks like work --- Thomas Edison
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform