Hi maxhugen,
Thank you for your reply. I actually changed the approach alltogether
and am now looping through my recordset, creating an output string of
all of the values for each field for each record, then writing the
output string to a text file using the Print command. Not only does
this approach avoid the '100 iteration' pitfall, but each iteration is
also faster! I've included the code below in case you (or anyone else)
is interestd.
Ben.
Public Sub mcrCreateTextFile(strObject As String, strFileName As
String)
Dim rs As DAO.Recordset
Dim strSQL As String
Dim intFile As Integer
Dim strOutput As String
Dim qdfFieldNames As DAO.QueryDef
Dim fld As DAO.Field
strSQL = "SELECT * FROM " & strObject & ";"
intFile = FreeFile()
Set rs = CurrentDb.OpenRecordset(strSQL)
Open strFileName For Output As #intFile
Set qdfFieldNames = CurrentDb.QueryDefs(strObject)
With rs
.MoveFirst
Do While Not .EOF
For Each fld In qdfFieldNames.Fields
strOutput = strOutput & rs.Fields(fld.Name) & ","
Next
strOutput = Left(strOutput, Len(strOutput) - 1) &
vbCrLf
.MoveNext
Loop
.Close
End With
Set rs = Nothing
strOutput = Left(strOutput, Len(strOutput) - 2)
Print #intFile, strOutput
Close #intFile
End Sub