Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Appending fields from a table
Message
De
19/06/2002 17:40:30
 
 
À
19/06/2002 17:15:56
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00670283
Message ID:
00670329
Vues:
28
>>What do you mean by "for the first record only"? Are you expecting it to append several records? A not eof() loop won't help...because that function won't evaluate properly for the table you are appending from (at least I don't think it will).
>>
>Steve:
>
>I have two tables RefDocsAddy and RefDocsWithAddress.
>
>RefDocsAddy has the following fields: Number, Name, Speciality, City
>RefDoscWithAddress has the more fields in addtion to the fields in RefDocsAddy
>
>What I am trying to accomplish is, if there is a matching value in the Number fields of both tables, then I want RefDocsAddy.Speciality and RefDocsAddy.City to be inserted into RefDocsWithAddress.Speciality and RefDocsWithAddress.Location. Then move to the next record and if there is a match, do the same.
>
>Hope I am making sense. Thanks.

So,
This code may help you
LOCAL loRefDocsAddy
SET EXACT ON

IF !USED('RefDocsAddy') THEN
  USE RefDocsAddy IN 0
ENDIF

IF !USED('RefDoscWithAddress') THEN
  USE RefDoscWithAddress IN 0
ENDIF

SELECT RefDocsAddy
SCAN
  SCATTER NAME loRefDocsAddy MEMO
  SELECT RefDoscWithAddress
  Locate For RefDoscWithAddress.Number = loRefDocsAddy.Number
  IF Found() THEN
    Replace Speciality WITH loRefDocsAddy.Speciality, Location WITH loRefDocsAddy.City
  ENDIF
  SELECT RefDocsAddy
ENDSCAN
Zlatin Zlatev,
MCSD (VS6)

Make solutions, not programs!

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform