Information générale
Titre:
Append a new record
Hi all,
I have the following program. Every time, when I run there is an error message: "Uniqueness of index key "cross_key" is violated" then I check the db, I find one record is add but the key fields(CROSS_ID, CURM_D) are null.
set exac on
sele pc_quota
set order to cross_key
if findrecord == .F.
allocat_array(1,1) = '01/2001'
endif
i =1
count_u =0
count_new =0
j = alen(allocat_array,1)
if messagebox('Are you sure to update?',4,'Confirm message') = 6
for y = 1 to totalmonth +1
txt_d = 'txt_d' + allt(str(y))
txt_q = 'txt_q' + allt(str(y))
select pc_quota
scan for thisform.&txt_d..value == allocat_array(i,1) and cross_id == crossid
if found()
replace curm_quo with allt(thisform.&txt_q..value )
count_u = count_u+1
i=i+1
else
append blank
replace cross_id with crossid
replace curm_d with thisform.&txt_d..value
replace curm_quo with thisform.&txt_q..value
count_new = count_new+1
endif
endscan
if i>j
i=1
endif
endfor
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement