By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,872 Members | 679 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,872 IT Pros & Developers. It's quick & easy.

Eliminate Blank Records from Exported Text file

P: 11
hi,

Good day. I use Ms Access 2003 to export data from table to TEXTFILE.

this is my Actual output:

EMP003 Matt Dwayne
EMP001 Josh Harnett

EMP005 Peter Parker
EMP006 Flakes Graham
EMP007 Kate Winslett

EMP009 Brittany Murphy
EMP010 Sophia Bush
EMP002 Jake Connor

EMP003 Bruce Wayne
EMP004 Mac Donalds



And this is my Desired output:
EMP003 Matt Dwayne
EMP001 Josh Harnett
EMP005 Peter Parker
EMP006 Flakes Graham
EMP007 Kate Winslett
EMP009 Brittany Murphy
EMP010 Sophia Bush
EMP002 Jake Connor
EMP003 Bruce Wayne
EMP004 Mac Donalds

How do I eliminate the blank spaces between in textfile.

Thank you!!!
Jul 3 '08 #1
Share this Question
Share on Google+
10 Replies

FishVal
Expert 2.5K+
P: 2,653
Hi, there.

You should provide more information:
  • How do you perform export?
  • Relevant dataset(s) metadata. Here is an example of how to post table MetaData :
    Table Name=tblStudent
    Expand|Select|Wrap|Line Numbers
    1. Field; Type; IndexInfo
    2. StudentID; AutoNumber; PK
    3. Family; String; FK
    4. Name; String
    5. University; String; FK
    6. Mark; Numeric
    7. LastAttendance; Date/Time

Regards,
Fish
Jul 3 '08 #2

NeoPa
Expert Mod 15k+
P: 31,770
Instead of exporting the table directly, create a Query which filters out empty lines. Export this query instead of the table.
Jul 4 '08 #3

P: 11
Instead of exporting the table directly, create a Query which filters out empty lines. Export this query instead of the table.



Hi,

I generate output thru using the Send report to a file using the Command button wizard. I am using a button to export a report.


How do I create a query that empty lines. Can elaborate on this.

Thanks
Jul 16 '08 #4

NeoPa
Expert Mod 15k+
P: 31,770
I can try, but I need a feeling for what you're already familiar with.

A. Do you have a query that the report runs from?
B. What do you know about queries already?

You should understand that queries only do base data - no totals or anything or even running totals.
Jul 16 '08 #5

P: 11
I can try, but I need a feeling for what you're already familiar with.

A. Do you have a query that the report runs from?
B. What do you know about queries already?

You should understand that queries only do base data - no totals or anything or even running totals.


Hi thanks for your time.

I have a query that displays what I need. Its just that there are spaces between.
My query is very basic. It selects the fields that I want to generate. I use the Output to function in Command Button. I can also use macro to export textfile from an existing Report.

and the textfiles appears like these:


00000001 1 DIRF
00000002 1 DIRF

00000003 1 DIRF
00000004 1 DIRF
00000005 1 DIRF

00000006 1 DIRF
00000007 1 DIRF
00000008 1 DIRF


Thank you for helping me.
Jul 17 '08 #6

NeoPa
Expert Mod 15k+
P: 31,770
Let's take the focus away from the report for the moment.

I need to know a bit about the query (what is its name and what is the SQL code for it)?

When run natively (again not the report - just running the query) does it include any blank lines then?
Jul 17 '08 #7

P: 11
Let's take the focus away from the report for the moment.

I need to know a bit about the query (what is its name and what is the SQL code for it)?

When run natively (again not the report - just running the query) does it include any blank lines then?

Hi there,

I created a table named RT1_Declarant_ Information_1_TBL
I created fields in this table. Then I made a query.
The query's name is Query1. I created an Expr1 field in the query to concatenate all the fields and put it in 1 field which is Expr1

sql view of query:
SELECT [SEQ_NUM] & [TYPE] & [DECLARANTS] & [FILENAME] & [CALENDAR_YR] & [O/R] & [DECLARATION_STATUS] & [NAME_BUSNAME_DEC] AS Expr1
FROM [RT1_Declarant_ Information_1];


If I run the concatenated query Expr1: [SEQ_NUM] & [TYPE] & [DECLARANTS] & [FILENAME] & [CALENDAR_YR] & [O/R] & [DECLARATION_STATUS] & [NAME_BUSNAME_DEC]


and export it in Export Text wizard as text, with delimited, Other: | (pipeline)
and Text qualifier as none>next>finish

I can get the desired output without quotes. But this is a very long process for a user.....

If I try to use Query1 to make a Report. The Output appears like this:


00000004100023569995DIRF2008R1131200811SMITH,JULES
00000005145467623417979DIRF2008O2100200811WAYNE,BR UCE
00000006100087844554DIRF2008O2111200811ANDREWS,REN EE

00000007178797998989945DIRF2008O1120200801ALLEN,MA RK
00000008100098989255DIRF2008O1131200811OWEN,HALLE
00000009147232645666665DIRF2008O1100200811MOONIE,I AN

00000010100059855685DIRF2008O1111200811CASTILLO,MA NUEL
00000011158956563365886DIRF2006R1220200810AMANTE,P OPE
00000012115487875215457DIRF2002R1231200810SALTA,NE IL



Is there a macro that can output textfile from a query without quotes so I can just use a macro in a Command button.

I would like to export data from an existing concatenated query Expr1 to an output textfle without spaces..

Thanks again. :)
Jul 18 '08 #8

NeoPa
Expert Mod 15k+
P: 31,770
Ah, now we have something a little more solid to work with. Well done.

Try :
Expand|Select|Wrap|Line Numbers
  1. SELECT [SEQ_NUM] &
  2.        [TYPE] &
  3.        [DECLARANTS] &
  4.        [FILENAME] &
  5.        [CALENDAR_YR] &
  6.        [O/R] &
  7.        [DECLARATION_STATUS] &
  8.        [NAME_BUSNAME_DEC] AS Expr1
  9. FROM [RT1_Declarant_ Information_1]
  10. WHERE [SEQ_NUM] &
  11.       [TYPE] &
  12.       [DECLARANTS] &
  13.       [FILENAME] &
  14.       [CALENDAR_YR] &
  15.       [O/R] &
  16.       [DECLARATION_STATUS] &
  17.       [NAME_BUSNAME_DEC]=''
This may well work better for your report too (depending on exactly what you need in it).

A query (QueryDef) with this SQL can be exported from within Access.
Jul 18 '08 #9

P: 11
Hi thanks for your time, however, the code that you gave me outputs a blank query. Am I missing something?
Jul 21 '08 #10

NeoPa
Expert Mod 15k+
P: 31,770
Ah, now we have something a little more solid to work with. Well done.

Try :
Expand|Select|Wrap|Line Numbers
  1. SELECT [SEQ_NUM] &
  2.        [TYPE] &
  3.        [DECLARANTS] &
  4.        [FILENAME] &
  5.        [CALENDAR_YR] &
  6.        [O/R] &
  7.        [DECLARATION_STATUS] &
  8.        [NAME_BUSNAME_DEC] AS Expr1
  9. FROM [RT1_Declarant_ Information_1]
  10. WHERE [SEQ_NUM] &
  11.       [TYPE] &
  12.       [DECLARANTS] &
  13.       [FILENAME] &
  14.       [CALENDAR_YR] &
  15.       [O/R] &
  16.       [DECLARATION_STATUS] &
  17.       [NAME_BUSNAME_DEC]=''
This may well work better for your report too (depending on exactly what you need in it).

A query (QueryDef) with this SQL can be exported from within Access.
Probably not.

I don't have direct access to your database so can't check how various fields are set up. Try changing the [=''] in line 17 to [ Is Null] instead :
Expand|Select|Wrap|Line Numbers
  1. [NAME_BUSNAME_DEC] Is Null
Jul 26 '08 #11

Post your reply

Sign in to post your reply or Sign up for a free account.