ninjaman01
Programmer
Hi,
I have a textbox in my form wherein a user can choose a zip folder on the directory and click the extract button to extract the file and display the record to the grid of the form. however when a user once again extract a different zipped folder it only add more records to the grid. what i want is when a user extract a new/different zipped folder it will overwrite the existing record displaying in my grid with a new record, thank you.
I have a textbox in my form wherein a user can choose a zip folder on the directory and click the extract button to extract the file and display the record to the grid of the form. however when a user once again extract a different zipped folder it only add more records to the grid. what i want is when a user extract a new/different zipped folder it will overwrite the existing record displaying in my grid with a new record, thank you.
Code:
//this my code//
mdir = "C:\Downloads\"
if .not. directory(mdir)
md &mdir
endif
mfile = thisform.txtEmprpath.value
if empty(mfile)
m = messageb("No selected ZIP File. Please select folder to be extract",64,"Select ZIP File")
return
endif
mfname = juststem(mfile)
mzip = mfname +".zip"
mfile1 = mfname +".dbf"
mtofile = mfile + " " + "-o" + mdir +" "+ mfile1 + " " + "-aoa"
run 7z x &mtofile
mfile1 = mdir + mfile1
mymess = ""
if .not. file(mfile1)
m = messagebox("Operation Cancelled. " + mfile1 + " does not exist",64,"Extract File")
else
use &mfile1 alias mfile1 in 0 shared
select mfile1
go top
do while .not. eof()
memprole = emprole
mrlvl = rollevel
scatter memvar
&&Display the records of extracted dbf file
select tmpex
delete for emprole = memprole .and. rollevel = mrlvl
append blank
gather memvar
select mfile1
skip
enddo
m = messagebox("Extraction Completed",64,"Extract File")
endif
m = closedbf("mfile1")
thisform.refresh