RE: Corrupted *.fpt
Don't die with memo fields, just stop using them. A5 seems like a very reliable program to me - with the single exception of the memo field. I have used A5 (and previously A4) for 7+ years and have never lost data, except from memo fields. And over the years, I have lost significant data from memo fields in a couple of important tables. Below is a script that I used to take data out of a memo field (from a backup after corruption was detected) and store it in character fields in a child to the original table. Although entry in the child table's char field is less user-friendly than it was in the memo field, I feel the data security is worth it. I hope that this will be useful to someone - and good luck to those who are still using memo fields!
-Bill
dim input as p
dim comment as p
dim id as n
dim text as c
dim times as n
input = table.open("pictures")
input.fetch_goto(1)
comment = table.open("pic_com")
while .not. input.fetch_eof()
text = alltrim(input.desc)
if text ""
if len(text) > 75
times = floor(len(text)/75)
x = 1
while times >= x
y = x*75
z = y-74
t1 = substr(text, var->z, var->y)
comment.enter_begin()
comment.id = input.pic_id
comment.comment = t1
comment.enter_end(.t.)
x = x + 1
end while
last = len(text) - (75 * times)
if last > 0
comment.enter_begin()
comment.id = input.pic_id
comment.comment = substr(text, times * 75, (times * 75) + last)
comment.enter_end(.t.)
end if
else
comment.enter_begin()
comment.id = input.pic_id
comment.comment = input.desc
comment.enter_end(.t.)
end if
end if
input.fetch_next()
end while
input.close()
comment.close()
ui_msg_box("Finished", "Pic_com is done.")
end
Don't die with memo fields, just stop using them. A5 seems like a very reliable program to me - with the single exception of the memo field. I have used A5 (and previously A4) for 7+ years and have never lost data, except from memo fields. And over the years, I have lost significant data from memo fields in a couple of important tables. Below is a script that I used to take data out of a memo field (from a backup after corruption was detected) and store it in character fields in a child to the original table. Although entry in the child table's char field is less user-friendly than it was in the memo field, I feel the data security is worth it. I hope that this will be useful to someone - and good luck to those who are still using memo fields!
-Bill
dim input as p
dim comment as p
dim id as n
dim text as c
dim times as n
input = table.open("pictures")
input.fetch_goto(1)
comment = table.open("pic_com")
while .not. input.fetch_eof()
text = alltrim(input.desc)
if text ""
if len(text) > 75
times = floor(len(text)/75)
x = 1
while times >= x
y = x*75
z = y-74
t1 = substr(text, var->z, var->y)
comment.enter_begin()
comment.id = input.pic_id
comment.comment = t1
comment.enter_end(.t.)
x = x + 1
end while
last = len(text) - (75 * times)
if last > 0
comment.enter_begin()
comment.id = input.pic_id
comment.comment = substr(text, times * 75, (times * 75) + last)
comment.enter_end(.t.)
end if
else
comment.enter_begin()
comment.id = input.pic_id
comment.comment = input.desc
comment.enter_end(.t.)
end if
end if
input.fetch_next()
end while
input.close()
comment.close()
ui_msg_box("Finished", "Pic_com is done.")
end
Comment