russi
10-24-2007, 07:58 AM
Hi.
Stupid question, but I have Access 97 database with ssn in each record.
I need to create a comma-delimted text file with these ssns.
When I use the export text file with a query that lists each record's ssn, it does not produce comma-delimited file.
How?
Russ
boblarson
10-24-2007, 08:12 AM
Use DoCmd.TransferText but before that create an Export Specification that you can use within that command to specify comma-delimited.
See here how to create an Export Specification:
http://www.btabdevelopment.com/main/LinkClick.aspx?link=64&tabid=55&mid=385
russi
10-24-2007, 08:35 AM
The only problem is that when i open the file, it shows each ssn in a separate line without commas.
And the ftp site rejects it as a bad file.
The file wants the ssns, listed in a row with commas.
I did follow your links' instructions...
Russ
boblarson
10-24-2007, 08:45 AM
The only problem is that when i open the file, it shows each ssn in a separate line without commas.
And the ftp site rejects it as a bad file.
The file wants the ssns, listed in a row with commas.
I did follow your links' instructions...
Russ
If you want them all on the same row, then you'll have to go this route:
Dim strFilePath As String
Dim strRow As String
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "YourTableNameHere", CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
Open strFilePath For Output As #1
Do Until rst.EOF
strRow = strRow & rst(0) & ","
rst.MoveNext
Loop
strRow = Left(strRow,Len(strRow)-1)
Print #1, strRow
Close #1
rst.Close
Set rst = Nothing