Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing memo fields in two related files

Status
Not open for further replies.

DEBWEST

IS-IT--Management
Sep 21, 2001
23
US
I have two files that have identical structures. The fpt file for one of them had a pointer error and has become unusable. I have tried every program to try to fix it, but the information in the fields continues to be incorrect.

The is a data base that has the same structure that has the correct info for the memo fields. I have set the relation but I cannot figure out how do do the replace since the memo field names are the same. Does a anyone know how?

Thanks
 
Firstly, Backup both the corrupted and uncorrupted files.

Suppose you have 2 databases named GOOD and BAD
The common memo field name is MEMFIELD

Get the database record pointers to the correct records in each database.
REPLACE GOOD.MEMFIELD WITH BAD.MEMFIELD is the syntax.

Do you know how to set up the pointers to the appropriate records?
 
Yes I do, I'm doing brow nowait and as I go thru the first dadabase, I go to the correct record in the second one. Is that what you mean?

Thaanks...
 
Yes, if you issue a command like
BROW FIELDS first.field1,first.field2, first.field3,second.field1,second.field2,second.field3
you will be assured that you have records matched.
where First is the name of the source dbf, and Second is the name of the destination dbf
You can then use the a command like
REPLACE ALL second.memfield WITH first.memfield

 
Rob,

I've tried to run that program several times. I must be doing something wrong. Maybe you can help. I say 'Do cmrepr26, It asks for the table name, I provide that, I get the programs ain screen, I change the table type to 'foxpro with memo', then I select the first memo field , and select 'memo repairing', it goes to the next screern, and I click the gary button for place and staple (whatever that is) and I slect two different files with the same structure, the I click on repair. First is says memo file invaid, then that the output files have an incorrect number of records, the I get alis not found, then it locks up. can you help?

Thank you!
 
Do you own a version of visual foxpro?
If so I can send you the newest repair module.

Another option is zipping the dbf and fpt file and sending it to me at nocure AT hccnet DOT nl

Rob.
 
Rob,

I don't have visual foxpro, so I tried to end my zipped files, but your mailbox was full? Any way I can get you this file?

Thanks
 
With exactly one memo field in the file, I'd use MODI STRU, DELETE the memo field. Ensure the memo file is gone. MODI STRU again to create the memo field. Back up the files in case things don't go as planned.

Then,

USE FILE1 ALIAS GOODFILE
INDEX ON KEY UNIQUE TAG IKEY
SET ORDER TO IKEY && redundant
SELE 0
USE FILE2 ALIAS BADFILE
SET RELA TO KEY INTO GOODFILE
REPL FOR NOT EOF("GOODFILE") MEMOFD WITH GOODFILE.MEMOFD
USE
SELE GOODFILE
DELE TAG ALL
CLOS DATA

If your key is not unique, plan on using SET SKIP TO.
 
Hi,

I've got six memo fields- do you think it will work with that many? I'm going to try it.

Thanks.
 
As long as the same key is valid for all of them it will work great.

REPL FOR NOT EOF("GOODFILE") ;
MEMOFD1 WITH GOODFILE.MEMOFD1, ;
MEMOFD2 WITH GOODFILE.MEMOFD2, ;
MEMOFD3 WITH GOODFILE.MEMOFD3, ;
MEMOFD4 WITH GOODFILE.MEMOFD4, ;
MEMOFD5 WITH GOODFILE.MEMOFD5, ;
MEMOFD6 WITH GOODFILE.MEMOFD6
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top