Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with a code....
Message
De
30/04/2001 18:20:12
 
 
À
30/04/2001 16:44:08
N. Lea
Nic Cross Enterprises
Valencia, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00501783
Message ID:
00501821
Vues:
18
>I need some coding that will assist me in determining if data already exists in another table.
>
>Basically, there are two free tables involved. The first table will house only one field (the account number (this is the table where data is entered by the end user)).
>
>the second table will house data imported over a course of time and stored for record purposes.
>
>Essentially, I need some help with finding a code that go through each individual account number in the first table (one by one) and seeks through the second table attempting to location a match. If the second table does not house an account number from the first table, that missing account number will be appended into the second table along with the current date.
>
>However, if an account number in table one matches an account number in table two, only the date is replace with the current date for that account number.
>
>Can anyone help me out? thanks!!!

There's lots of ways this could be done, dependant on how the indexing is set up for the tables. Assuming a one-to-one entry of the account codes in the second table, you can use a SEEK()
select table1
scan
   if SEEK( table1.accountnumber, table2, {tagname} )
      replace table2.date with date
   else
      insert into table2 (accountnumber,date) values (table1.accountnumber,date())
   endif
endscan
It gets a little trickier if there can be more than one record with the same account number in table 2.
Dan LeClair
www.cyberwombat.com
SET RANT ON - The Wombat Blog

Life isn’t a morality contest and purity makes a poor shield. - J. Peter Mulhern
Disclaimer: The comments made here are only my OPINIONS on various aspects of VFP, SQL Server, VS.NET, systems development, or life in general, and my OPINIONS should not be construed to be the authoritative word on any subject. No warranties or degrees of veracity are expressed or implied. Void where prohibited. Side effects may included dizziness, spontaneous combustion, or unexplainable cravings for dark beer. Wash with like colors only, serve immediately for best flavor.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform