Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dbf to Excel
Message
 
 
À
24/07/2007 09:53:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01243144
Message ID:
01243374
Vues:
17
Tariq,

See the changes inside your code:

I switched to TRY/CATCH instead of ON ERROR and also added ab4 as you wanted to copy your files there.

BTW, why do you need to open database exclusive? You should put this in try/catch as well if you want exclusive access (even for shared access it may fail).

>Dear Experts
>
>
>set century on
>
>lcfullpath = fullpath(curdir())
>lcfullpath = left(lcfullpath, len(lcfullpath) - 1)
>lclastfolder = justfname(lcfullpath)
>
>abc=alltrim("E:\SoftBkup\"+lclastfolder+alltrim("\")+alltrim("Xls")+alltrim("\"))
>ab4=alltrim(abc)+alltrim(dtos(date()))
>lcDir = sys(5)+alltrim(sys(2003)))+'\TABLES\'
>mdbcname= sys(5)+alltrim(sys(2003)))+'\TABLES\ACWS.dbc'
>#define crlf chr(13)+chr(10)
>
>close all
>close data
>open database (mdbcname) excl
>= adbobjects(latablearray, "TABLE") && Put table names into an array
>for i=1 to alen(latablearray,1) 	&& loop through each table in the array
>	mtablename= m.lcDir + latablearray(i) && pick up table name from array
>
>	*x=0

>	*on error x=error()
         llContinue = .t.
         try 
           select 0
>	  use (mtablename) alias WorkTable shared 	&& attempt to open table
>	catch to loErr
            llContinue = .f.
         endtry
>
>	if m.llContinue && we were able to open a table 
>	   copy to forceext(m.ab4 + juststem(m.mtablename),'xls') type xl5             
>	endif
         use in select('WorkTable') && close the table     
>next 
>
>
>The codes copy all dbf files to present directory.
>But I want to copy all dbf files with their orinal names to following location
>ab4
>How to modify path in this line
>
>copy to type xl5
>
>Please help
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform