export to text: remove blank lines/empty rows (1 Viewer)

anski

Registered User.
Local time
Today, 16:43
Joined
Sep 5, 2009
Messages
93
i am exporting a union query to a text file. i expect the cursor to be at the end of my data. instead, when i open the text file, the cursor is 2 rows away from the last row (with data). the export creates blank rows. the blank rows cause an error when i upload the text file to another program.

what do i use to remove the blank lines/empty rows?
 

Ranman256

Well-known member
Local time
Today, 04:43
Joined
Apr 9, 2015
Messages
4,339
Make another query that uses the union query,
Remove blanks in this query.
Export this.
 

anski

Registered User.
Local time
Today, 16:43
Joined
Sep 5, 2009
Messages
93
^the query does not have blank rows (or even blank fields).
 
Last edited:

JHB

Have been here a while
Local time
Today, 10:43
Joined
Jun 17, 2012
Messages
7,732
Could you post an example database that have the problem you describe?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:43
Joined
Feb 19, 2002
Messages
43,213
Open the union query in datasheet view and sort it on various columns. Eventually the empty rows will pop to the top.

Access does not create empty rows when you export. and "union" removes duplicates so that would remove all but one empty record anyway.

What code are you using for the export? Also post the union query SQL please.
 

anski

Registered User.
Local time
Today, 16:43
Joined
Sep 5, 2009
Messages
93
SOLVED: Re: export to text: remove blank lines/empty rows

the union query does not have any blank rows. i use the transfertext command to export to csv or text. i found something that works for me. this deletes the last blank row (access creates 2 blank rows) but still leaves one blank row which is acceptable to the program that i upload the exported file to.

if Right(sTemp, 2) = Chr(13) & Chr(10) Then
sTemp = Left(sTemp, Len(sTemp) - 2)
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:43
Joined
Feb 19, 2002
Messages
43,213
There is something wrong with your data. Access does not create blank rows on export.
 

Users who are viewing this thread

Top Bottom