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

SELECT SUM(factures.MONTTC) ; FROM

Status
Not open for further replies.

ahmed1973

Programmer
Jan 29, 2013
42
DZ
SELECT SUM(factures.MONTTC) ;
FROM GEST_JUR!factures ;
WHERE FACTURES.NUMAB=this.Parent.text1.Value AND factures.paiement="T" ;
INTO TABLE GEST_JUR!factempGLOB
this.Parent.text8.Value=FACTEMPGLOB.SUM_monttc
I received an error message "Alias 'FACTEMPGLOB' is not found".
How do I resolve this error PLease!
 
Is the table FactEmpGlob open?

if not, you need to open it

if not used("FactEmpGlob")
use FactEmpGlob in 0
endif

make sure you specify the path to the table if it is not in the correct/default diretory/folder.

example: use c:\MyApp\MyData\FactEmpGlob.dbf in 0


Ali Koumaiha
TeknoSoft Inc.
Michigan
 
I'd recommend to switch to cursors. That means instead of INTO TABLE you select INTO CURSOR.

It's not a good thing to add tables to a DBC, when working with muliutple users, at least. Indeed that can lead to errors, especially when you always overwrite. Unless the DBC is local, a DBC is not the place to store temp data.

Also Instead of relying on the autonaming of the SUM() expression to end in the field name SUM_monttc, specify the name directly in the SQL:

SELECT SUM(factures.MONTTC) as MontccTotal;
FROM ...

You gain more control and have more freedom in naming the fields.

Bye, Olaf.
 
I just realised that the error message might have come up on the second line (this.Parent.text8.Value=FACTEMPGLOB.SUM_monttc) rather than the SELECT.

If that's so, then Ali's advice is good. Or, you could change it to this:

Code:
this.Parent.text8.Value=GEST_JUR!FACTEMPGLOB.SUM_monttc

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top