Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why does this not work?
Message
De
18/12/2004 00:47:15
 
 
À
17/12/2004 16:31:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
00970191
Message ID:
00970280
Vues:
12
>The following code is in the lostfocus event of a text field getting data from a barcode reader.
>The idea is to keep the data in the variable until it is changed. Location, UPC or Quantity. Increasing the count on the specific UPC if it is read in again. But it keeps creating a new record instead.
>
>
>CNTTEMP=This.Value
>* This says where the product is
>If Left(CNTTEMP,1)="*"
> TEMPLOC=Substr(CNTTEMP,2)
>Else
>* this it to change quantity by more than one at a time
> If Left(CNTTEMP,1)="#"
> TEMPCOUNT=Val(Substr(CNTTEMP,2))
> Seek TEMPUPC Order Tag CUPC In INVCOUNT
> If Found()
> Replace INVCOUNT.NCOUNT With INVCOUNT.NCOUNT+TEMPCOUNT In INVCOUNT
> Endif
> Else
>* this is the product UPC code
> TEMPUPC=CNTTEMP
> Locate For TEMPLOC=INVCOUNT.CLOCATION While TEMPUPC = INVCOUNT.CUPC
> If Found()
> Replace INVCOUNT.NCOUNT With INVCOUNT.NCOUNT+1 In INVCOUNT
> Else
> Append Blank In INVCOUNT
> Replace INVCOUNT.CLOCATION With TEMPLOC
> Replace INVCOUNT.CUPC With TEMPUPC
> Replace INVCOUNT.NCOUNT With 1
> Endif
> Endif
>Endif
>CNTTEMP=""
>Thisform.Refresh


LOCATE with a WHILE use a REST scope.
* WORKAREA ACTIVE ? i guess that INVCOUNT it is the current alias
 Locate ALL For m.TEMPLOC=CLOCATION While m.TEMPUPC = CUPC
 If Found()
   Replace NCOUNT With NCOUNT+1
 Else
   * if alias()#'INVCOUNT', now you have EOF()=.T., and replace don't replace anything !
   * then i guess that INVCOUNT it is the current alias
   Append Blank
   Replace CLOCATION With m.TEMPLOC;
       ,   CUPC      With m.TEMPUPC;
       ,   NCOUNT    With 1
   * best INSERT INTO INVCOUNT (CLOCATION,...) VALUES (m.TEMPLOC, m.TEMPUPC, 1)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform