473,763 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export Table Data To Formatted Text File

I have data in a table in an Access 2000 database that needs to be exported
to a formatted text file. For instance, the first field is an account number
that is formatted in the table as text and is 8 characters long. This field
needs to be exported as pic(15) padded in the front with 0's (zeros). The
next field an ID name that is 15 characters that needs to be exported as
pic(20) padded with trailing spaces. There are about 5 fields in total that
need this type of formatting when being exported (and about 200 records) to
this text file as well as a requirement of a space between each field. Any
help would be greatly appreciated.

Marco
Jun 21 '07 #1
9 7714
NEWSGROUPS wrote:
I have data in a table in an Access 2000 database that needs to be exported
to a formatted text file. For instance, the first field is an account number
that is formatted in the table as text and is 8 characters long. This field
needs to be exported as pic(15) padded in the front with 0's (zeros). The
next field an ID name that is 15 characters that needs to be exported as
pic(20) padded with trailing spaces. There are about 5 fields in total that
need this type of formatting when being exported (and about 200 records) to
this text file as well as a requirement of a space between each field. Any
help would be greatly appreciated.

Marco

Maybe create a query and export that instead of a table.

When you create the export (click on the query and select File/Export
then select .Txt as the type then the Export button. You'll step
through the wizard. You want to press Advanced to create an export
specification if you will be doing this more than once. One of the
options is to specify the delimiter...spa ce being one.

Man, I haven't seen anything like pic(15) since my...too many years have
passed.

Jun 21 '07 #2
I appreciate your reply and have tried this method, but this will be an
everyday occurance and this does not allow the padding in the front or rear
of the field with spaces or zeros.

Marco

"salad" <oi*@vinegar.co mwrote in message
news:W6******** *********@newsr ead3.news.pas.e arthlink.net...
NEWSGROUPS wrote:
>I have data in a table in an Access 2000 database that needs to be
exported to a formatted text file. For instance, the first field is an
account number that is formatted in the table as text and is 8 characters
long. This field needs to be exported as pic(15) padded in the front with
0's (zeros). The next field an ID name that is 15 characters that needs
to be exported as pic(20) padded with trailing spaces. There are about 5
fields in total that need this type of formatting when being exported
(and about 200 records) to this text file as well as a requirement of a
space between each field. Any help would be greatly appreciated.

Marco
Maybe create a query and export that instead of a table.

When you create the export (click on the query and select File/Export then
select .Txt as the type then the Export button. You'll step through the
wizard. You want to press Advanced to create an export specification if
you will be doing this more than once. One of the options is to specify
the delimiter...spa ce being one.

Man, I haven't seen anything like pic(15) since my...too many years have
passed.

Jun 21 '07 #3
In the Design view of the Query you should specify the fields that need to
be padded as defined fields. The account field might look something like
this:

acct15:right("0 00000000000000" & TRIM(account),1 5)

The ID field might look something like this with 20 spaces between the quote
marks:

id20:left(TRIM( ID) & " ",20)

Using these string functions you should be able to build whatever fields you
need to export.

I hope this helps,
David
"NEWSGROUPS " <he******@yahoo .comwrote in message
news:Mu******** *************** *******@comcast .com...
I appreciate your reply and have tried this method, but this will be an
everyday occurance and this does not allow the padding in the front or
rear
of the field with spaces or zeros.

Marco

"salad" <oi*@vinegar.co mwrote in message
news:W6******** *********@newsr ead3.news.pas.e arthlink.net...
NEWSGROUPS wrote:
I have data in a table in an Access 2000 database that needs to be
exported to a formatted text file. For instance, the first field is an
account number that is formatted in the table as text and is 8
characters
long. This field needs to be exported as pic(15) padded in the front
with
0's (zeros). The next field an ID name that is 15 characters that needs
to be exported as pic(20) padded with trailing spaces. There are about
5
fields in total that need this type of formatting when being exported
(and about 200 records) to this text file as well as a requirement of a
space between each field. Any help would be greatly appreciated.

Marco
Maybe create a query and export that instead of a table.

When you create the export (click on the query and select File/Export
then
select .Txt as the type then the Export button. You'll step through the
wizard. You want to press Advanced to create an export specification if
you will be doing this more than once. One of the options is to specify
the delimiter...spa ce being one.

Man, I haven't seen anything like pic(15) since my...too many years have
passed.


Jun 21 '07 #4
NEWSGROUPS wrote:
I appreciate your reply and have tried this method, but this will be an
everyday occurance and this does not allow the padding in the front or rear
of the field with spaces or zeros.

Marco

"salad" <oi*@vinegar.co mwrote in message
news:W6******** *********@newsr ead3.news.pas.e arthlink.net...
>>NEWSGROUPS wrote:
>>>I have data in a table in an Access 2000 database that needs to be
exported to a formatted text file. For instance, the first field is an
account number that is formatted in the table as text and is 8 characters
long. This field needs to be exported as pic(15) padded in the front with
0's (zeros). The next field an ID name that is 15 characters that needs
to be exported as pic(20) padded with trailing spaces. There are about 5
fields in total that need this type of formatting when being exported
(and about 200 records) to this text file as well as a requirement of a
space between each field. Any help would be greatly appreciated.

Marco

Maybe create a query and export that instead of a table.

When you create the export (click on the query and select File/Export then
select .Txt as the type then the Export button. You'll step through the
wizard. You want to press Advanced to create an export specification if
you will be doing this more than once. One of the options is to specify
the delimiter...spa ce being one.

Man, I haven't seen anything like pic(15) since my...too many years have
passed.
David gave you the correct methods. You'll need to learn how to perform
string manipulation. Look at the following functions in
help...hint...c reate a new module. Enter the following words into the
code module. Hightlight each one and press the F1 key. Look at any
code examples for each function.
Left
Right
Mid
String
Len
Space
Trim
LTrim
Rtrim
NZ
Format
Str
Cstr (and related items)
Instr
for starters.

The & is used to concatenate variables/values together.
Jun 21 '07 #5
Man, I haven't seen anything like pic(15) since my...too many years have
passed.
I haved seen this since back in my COBOL days, oh the
memories...... :)
bobh.

On Jun 20, 10:11 pm, salad <o...@vinegar.c omwrote:
NEWSGROUPS wrote:
I have data in a table in an Access 2000 database that needs to be exported
to a formatted text file. For instance, the first field is an account number
that is formatted in the table as text and is 8 characters long. This field
needs to be exported as pic(15) padded in the front with 0's (zeros). The
next field an ID name that is 15 characters that needs to be exported as
pic(20) padded with trailing spaces. There are about 5 fields in total that
need this type of formatting when being exported (and about 200 records) to
this text file as well as a requirement of a space between each field. Any
help would be greatly appreciated.
Marco

Maybe create a query and export that instead of a table.

When you create the export (click on the query and select File/Export
then select .Txt as the type then the Export button. You'll step
through the wizard. You want to press Advanced to create an export
specification if you will be doing this more than once. One of the
options is to specify the delimiter...spa ce being one.

Man, I haven't seen anything like pic(15) since my...too many years have
passed.

Jun 21 '07 #6
I have tried this suggestion with much sucess.Thank you. But one problem
still remains. One of the fields I have to export to this text file is a
number field formatted as a double that represents a dollar amount (what
this means for instance is the amount $255.00 is stored in the table as 255
and the amount $255.50 is stored as 255.5). I needed to export these fields
without the decimal point so what should be on the text file for the $255.00
is 25500 and the $255.50 will be shown as 25550 with the right most 2 digits
being the implied decimal. The problem here as you can see from my example
is there are not always 2 decimal places on all my records. I tried
appending the records to a currency field which did display the correct
format but when I pass this to a function to strip the decimal place or use
an in string to get the left() of the decimal the $255.00 returns an error
and the $255.50 returns 2555 as if the decimal does not exist. Can anyone
offer assistance in this matter as I have tried everything possible.

Marco

"David Harlowe" <da***********@ nomail.comwrote in message
news:6q******** **********@news svr29.news.prod igy.net...
In the Design view of the Query you should specify the fields that need to
be padded as defined fields. The account field might look something like
this:

acct15:right("0 00000000000000" & TRIM(account),1 5)

The ID field might look something like this with 20 spaces between the
quote
marks:

id20:left(TRIM( ID) & " ",20)

Using these string functions you should be able to build whatever fields
you
need to export.

I hope this helps,
David
"NEWSGROUPS " <he******@yahoo .comwrote in message
news:Mu******** *************** *******@comcast .com...
>I appreciate your reply and have tried this method, but this will be an
everyday occurance and this does not allow the padding in the front or
rear
>of the field with spaces or zeros.

Marco

"salad" <oi*@vinegar.co mwrote in message
news:W6******* **********@news read3.news.pas. earthlink.net.. .
NEWSGROUPS wrote:
I have data in a table in an Access 2000 database that needs to be
exported to a formatted text file. For instance, the first field is an
account number that is formatted in the table as text and is 8
characters
>long. This field needs to be exported as pic(15) padded in the front
with
>0's (zeros). The next field an ID name that is 15 characters that
needs
to be exported as pic(20) padded with trailing spaces. There are about
5
>fields in total that need this type of formatting when being exported
(and about 200 records) to this text file as well as a requirement of
a
space between each field. Any help would be greatly appreciated.

Marco
Maybe create a query and export that instead of a table.

When you create the export (click on the query and select File/Export
then
select .Txt as the type then the Export button. You'll step through
the
wizard. You want to press Advanced to create an export specification
if
you will be doing this more than once. One of the options is to
specify
the delimiter...spa ce being one.

Man, I haven't seen anything like pic(15) since my...too many years
have
passed.



Jun 22 '07 #7
NEWSGROUPS wrote:
I have tried this suggestion with much sucess.Thank you. But one problem
still remains. One of the fields I have to export to this text file is a
number field formatted as a double that represents a dollar amount (what
this means for instance is the amount $255.00 is stored in the table as 255
and the amount $255.50 is stored as 255.5). I needed to export these fields
without the decimal point so what should be on the text file for the $255.00
is 25500 and the $255.50 will be shown as 25550 with the right most 2 digits
being the implied decimal. The problem here as you can see from my example
is there are not always 2 decimal places on all my records. I tried
appending the records to a currency field which did display the correct
format but when I pass this to a function to strip the decimal place or use
an in string to get the left() of the decimal the $255.00 returns an error
and the $255.50 returns 2555 as if the decimal does not exist. Can anyone
offer assistance in this matter as I have tried everything possible.

Marco
I'm curious...did you try Round yet? You really would want to round a
double...who knows what the real value of the number is.

Don't know what version you are working. You might want to check out
the following link for rounding
http://www.mvps.org/access/modules/mdl0054.htm if the Round() function
isn't available in your version.

So your column might look like this:
RoundedValue : Round([Price],2) * 100
Jun 22 '07 #8
Thank you it worked perfectly. I guess I was over thinking this. I though it
had to be more complex.

Thanks again,
Marco
"salad" <oi*@vinegar.co mwrote in message
news:88******** *********@newsr ead4.news.pas.e arthlink.net...
NEWSGROUPS wrote:
>I have tried this suggestion with much sucess.Thank you. But one problem
still remains. One of the fields I have to export to this text file is a
number field formatted as a double that represents a dollar amount (what
this means for instance is the amount $255.00 is stored in the table as
255 and the amount $255.50 is stored as 255.5). I needed to export these
fields without the decimal point so what should be on the text file for
the $255.00 is 25500 and the $255.50 will be shown as 25550 with the
right most 2 digits being the implied decimal. The problem here as you
can see from my example is there are not always 2 decimal places on all
my records. I tried appending the records to a currency field which did
display the correct format but when I pass this to a function to strip
the decimal place or use an in string to get the left() of the decimal
the $255.00 returns an error and the $255.50 returns 2555 as if the
decimal does not exist. Can anyone offer assistance in this matter as I
have tried everything possible.

Marco

I'm curious...did you try Round yet? You really would want to round a
double...who knows what the real value of the number is.

Don't know what version you are working. You might want to check out the
following link for rounding http://www.mvps.org/access/modules/mdl0054.htm
if the Round() function isn't available in your version.

So your column might look like this:
RoundedValue : Round([Price],2) * 100


Jun 22 '07 #9
NEWSGROUPS wrote:
Thank you it worked perfectly. I guess I was over thinking this. I though it
had to be more complex.

Thanks again,
Marco
LOL. I have found that when I get frustrated about how I want it to do
this but the program wants to do that I need to step back, relax, do
something to get my mind off the task at hand. Coming back refreshed
and with an open mind often times provides solutions....I was too buried
in the trees to see the forest.
>

"salad" <oi*@vinegar.co mwrote in message
news:88******** *********@newsr ead4.news.pas.e arthlink.net...
>>NEWSGROUPS wrote:

>>>I have tried this suggestion with much sucess.Thank you. But one problem
still remains. One of the fields I have to export to this text file is a
number field formatted as a double that represents a dollar amount (what
this means for instance is the amount $255.00 is stored in the table as
255 and the amount $255.50 is stored as 255.5). I needed to export these
fields without the decimal point so what should be on the text file for
the $255.00 is 25500 and the $255.50 will be shown as 25550 with the
right most 2 digits being the implied decimal. The problem here as you
can see from my example is there are not always 2 decimal places on all
my records. I tried appending the records to a currency field which did
display the correct format but when I pass this to a function to strip
the decimal place or use an in string to get the left() of the decimal
the $255.00 returns an error and the $255.50 returns 2555 as if the
decimal does not exist. Can anyone offer assistance in this matter as I
have tried everything possible.

Marco

I'm curious...did you try Round yet? You really would want to round a
double...wh o knows what the real value of the number is.

Don't know what version you are working. You might want to check out the
following link for rounding http://www.mvps.org/access/modules/mdl0054.htm
if the Round() function isn't available in your version.

So your column might look like this:
RoundedValu e : Round([Price],2) * 100
Jun 22 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
14792
by: Paolo | last post by:
Friends, I need help with some code to export different tables to a single spreadsheet in Excel. My excel file is named REPORT and the spreadsheet is named CLIENTS. I do have the code to export a single table to Excel but have problems with multimple tables. Thanks.
3
4906
by: Jorge Cecílio | last post by:
Hi! I would like to export some MS-Access reports output to pdf. However, the only possibility offered by Access (afaik) for me to export formatted output is snp (snapshot) (I use MS-Office XP Prof. 2002 version). With formatted output I mean the *exactly* output I produce from executing my report (information is gathered from an ODBC database).
3
8027
by: nologin | last post by:
Is it possible to export data exposed by DataView to Excel file for example ? Seba
3
3960
by: Daniel Wetzler | last post by:
Dear MSSQL- experts, I have a strange problem with SQLSERVER 2000. I tried to export a table of about 40000 lines into a text file using the Enterprise manager export assitant. I was astonished to get an exported text file of about 400 MB instead 16 MB which is the normal size of that data. By examining this file with a text editor I found that the file included alongside the data of my table MANY zeros which caused the big file size.
5
37328
by: RadhakrishnanR | last post by:
Hi, By using VB6.0, I want to export database table data into (i.e based on the selected file type(xls or txt)) excel file or text file with a tab delimited text file. My User interface has: • Drop down list box contain list of data base table name. • A path selection area, allowing the user to specify the filename, path and file type for the export. This will incorporate standard Windows functionality for allowing the user...
7
7810
by: Vanessa | last post by:
hi Everyone, I have two questions on exporting data to Excel using ASP (w/o converting formatted excel file into web page and then plug in the dynamic data): 1. Can we export data into different sheets at Excel? 2. Can we do graph at export? Thanks!!
1
9778
by: smaczylo | last post by:
Hello, I've recently been asked to work with Microsoft Access, and while I feel quite comfortable with Excel, I'm at a complete loss with databases. If someone could help me with this issue I'm having I'd be most appreciative. The database is already constructed, I'm just wanting to export the data to an excel file. In short, I'm hoping to export two Tables (or queries...not sure which to use - they both seem to have the same data) in...
7
28903
Merlin1857
by: Merlin1857 | last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can actually do something more with. This code shows you how to display data from your database and then how to give that data to the user in the form of a useable Excel spreadsheet which they can then take away and play with themselves. The way I have shown...
3
10978
by: Wayne | last post by:
I'm trying to automate the export of a query to a text file using code. If I export the query manually I get the exact result that I want i.e. If I select the query then choose File/Export from the menu bar, choose "Text" as the save format, and then select "fixed width" as the export format, I end up with a fixed width text file with no column headers. I've tried to automate the process using: DoCmd.OutputTo acOutputQuery,...
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10145
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.