Avoid System Tables when exporting to csv files

silvia

New member
Local time
Today, 14:36
Joined
Apr 8, 2002
Messages
5
Hello!
When I run the module to export all the tables in an Access database and convert them into csv files, all seems to work but the problem is that the system tables or system objects are exported as well. Can I export only the tables I really want ignoring these "hidden tables" (they contain info of the database files, the database and the tables)?

The code is:
Private Sub CmdExportFiles_Click()
Dim dbs As Database, tb As TableDef
Set dbs = CurrentDb
For Each tb In dbs.TableDefs
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, tb.Name, "C:\Documents\vba\" & tb.Name & ".csv", True

On Error Resume Next
Next tb
End Sub


Thanks!!

Silvia
 
Try:

Private Sub CmdExportFiles_Click()
Dim dbs As Database, tb As TableDef
Set dbs = CurrentDb
For Each tb In dbs.TableDefs
If Left(tb.Name,4)<>"MSys" then
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, tb.Name, "C:\Documents\vba\" & tb.Name & ".csv", True
End if
Next tb
End Sub
 
Fornatian,

Thanks very much!!

I just tested and it works!


Silvia
 

Users who are viewing this thread

Back
Top Bottom