Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sort in a program
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00088580
Message ID:
00088710
Vues:
27
>>Does anyone know why this sort command which works fine when
>>in code with nothing after it has the problem that the
>>subsequent code begins executing before it finishes
>>sorting: Sort to c:\mydirectory\stock1.dbf on Number
>>How can I make subsequent commands wait for this one to
>>finish executing. Thanks in advance-Derek
>
>Derek, are these commands consecutive in the same method/prg/code? Or are they in separate methods? Perhaps you could post your code....

Dear Barbara:
Here is the code which runs off the click event of a command
button. If you sort it first and * out the sort command
everything runs fine. But if you include it you get a
file use use error which I believe means the program proceeds
without letting the sort finish. I'm grateful for any help,
Derek.

use c:\suspense\Invrprt\Invtotalp.dbf
delete all
pack
Sort to c:\suspense\stock1.dbf on Number
m.begin = (allt(upper(thisform.text1.value)))
m.last = (allt(upper(thisform.text2.value)))

m.date = date()
use c:\suspense\Invrprt\totfilep.dbf

Set order to date1
if seek (m.date)
replace gtotalcost with 0
replace gtotalret with 0
else
append blank
replace date1 with m.date
endif
Use c:\suspense\stock1.dbf
set order to number

seek m.begin
skip -1
m.number =number
Do While m.number # m.last
skip 1
m.numsave = number
M.number = number
m.uncost = uncost
m.units = units
m.desc = desc
m.price1 = price1
Do case
case m.units > 0.00
use c:\suspense\Invrprt\Invtotalp.dbf
append blank
replace number with m.number
replace desc with m.desc
replace units with m.units
replace uncost with m.uncost
replace price1 with m.price1
m.extprice = m.units * m.price1
Replace totalret with m.extprice
m.extcost = m.units * m.uncost
replace totalcost with m.extcost
use c:\suspense\invrprt\totfilep.dbf
set order to date1
locate for (date1) = m.date
m.totala = gtotalcost
m.totalb = gtotalret
m.total1 = m.totala + m.extcost
m.total2 = m.totalb + m.extprice
replace gtotalcost with m.total1
replace gtotalret with m.total2
use c:\suspense\stock1.dbf
set order to number
locate for (number) = (numsave)
m.number = number
endcase
enddo
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform