Article ID: 116037
Article Last Modified on 10/15/2003
SET DEFAULT TO C:\<FoxPro_directory>\TUTORIAL.
In Visual FoxPro, Issue the following:
SET DEFAULT TO C:\<FoxPro_directory>\SAMPLES\DATA
NOTE: In Visual FoxPro, you will also need to change all references
below from from CNO to CUST_ID.
USE customer
COPY TO newcust
SELECT 0
USE newcust
** the following command has no spaces between the quotation marks
REPLACE ALL company WITH ""
** BROWSE the table with the empty COMPANY field contents
BROWSE
CLEAR ALL
CLOSE ALL
** open a new program file called TEST
** if a program called TEST already exists, choose another name
MODIFY COMMAND test
SELECT 0
USE customer
SELECT 0
USE newcust
SELECT customer
** while not at end of file of CUSTOMER, do some actions
DO WHILE !EOF()
** select the destination table
SELECT newcust
** replace the empty COMPANY field with data from CUSTOMER where
** the common key field is the same
REPLACE newcust.company WITH customer.company;
FOR newcust.cno = customer.cno
** select the source table again to go to next record
SELECT customer
SKIP
ENDDO
SELECT newcust
** BROWSE the table with the newly filled COMPANY data
BROWSE
NOTE: If the first database (that is, CUSTOMER) is indexed on the common
key field between the two tables, replace the commands in step 3 with
the following:
SELECT 0
USE customer ORDER TAG cno
SELECT 0
USE newcust
REPLACE ALL newcust.company WITH customer.company FOR ;
seek(cno,"customer")Additional query words: FoxMac FoxDos FoxWin VFoxWin 2.50 2.50a 2.50b 2.50c 2.60
Keywords: kbcode KB116037