Link to home
Start Free TrialLog in
Avatar of PeterBaileyUk
PeterBaileyUk

asked on

expert table to csv in access

I want to expert some tables I have a recordset that moves through the tables i want to save, I am having trouble
saving the table

 it says error 3027

Dim Db As DAO.Database
Set Db = CurrentDb()
Dim rstClientDecodeTables As DAO.Recordset
Dim rstTable As DAO.Recordset
Dim rstTable2 As Object
Dim fldNew As Object
Dim strSQL As String
Dim strSQL2 As String
Dim strfield As String
Dim TableNameinFull As String
Dim qdef As QueryDef

Dim WordCountDecode As Long
Dim StrWordLength As String

Dim ModelName As String
Dim TblLength As Long
Dim ClientLength As Long

Dim reccount As Long
reccount = 0
strSQL = "SELECT MSysObjects.Name AS table_name" _
& " FROM MSysObjects" _
& " WHERE (((MSysObjects.Name) Like " & """*Extractionswithrules*""" & "))" _
& " ORDER BY MSysObjects.Name;"

Set rstClientDecodeTables = Db.OpenRecordset(strSQL)

Debug.Print strSQL

With rstClientDecodeTables
     If rstClientDecodeTables.BOF And rstClientDecodeTables.EOF Then
     
     Else
    .MoveFirst

    Do Until rstClientDecodeTables.EOF
    
        fname = "n:/temp/pete/" + Format(Date, "yyyymm") + " " & .Fields("table_name").Value.csv
        DoCmd.TransferText acExportDelim, , .Fields("table_name").Value, .Fields("table_name").Value, True
        .MoveNext
    Loop
End If
End With

rstClientDecodeTables.Close
Set rstClientDecodeTables = Nothing

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PeterBaileyUk
PeterBaileyUk

ASKER

worked a treat thank you