473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Export fixed-width file

Hi and TIA! I have a query that I want to save as a fixed-width text file. I can get the export to
work using an export specification with one exception. This is a government message and they need
the remarks field to print on a separate line from the details section and I can' figure out how to
get the remarks to start on a new line. So what I want is (Start Column & Width in parenthesis)

Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)

Is this possible? I've looked through all my literature and the NG, but have yet to come up with a
solution. Any advice or pointers as to where I can look up more info is appreciated. As always,
Thanks for your time!

--
Reggie

----------
Nov 13 '05 #1
5 3416
You could append a new line character(s) in front of the remarks field - in
your query, change the field to a calculated field such as:

tRemarks: Chr(13) & Chr(10) & [Remarks]

Since Access will count the two characters as part of the field, you'll need
to extend the field size in the specification to 52 characters though.

--
Shane Suebsahakarn
----
Head of IT
PAN Telecom
Tel: +44 (0) 870 757 7001

"Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message
news:k4********************@comcast.com...
Hi and TIA! I have a query that I want to save as a fixed-width text file. I can get the export to work using an export specification with one exception. This is a government message and they need the remarks field to print on a separate line from the details section and I can' figure out how to get the remarks to start on a new line. So what I want is (Start Column & Width in parenthesis)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)

Is this possible? I've looked through all my literature and the NG, but have yet to come up with a solution. Any advice or pointers as to where I can look up more info is appreciated. As always, Thanks for your time!

--
Reggie

----------

Nov 13 '05 #2
Hi Reggie

I think this will work for you...

************************************************** *********
Private Sub cmdExportQuery_Click()

Dim MyDB As DAO.Database
Set MyDB = CurrentDb
Dim rst As DAO.Recordset
Set rst = MyDB.OpenRecordset("qryReggie", dbOpenDynaset)

Open "C:\TEMP\TESTFILE.txt" For Output As #1 ' Open file for output.
'Note: The directory that will contain the text file (in this case
"C:\TEMP") must exist.

With rst
.MoveLast 'Populate the recordset
.MoveFirst
Do Until .EOF
'Print the contents of the first set of fields on the first line
Print #1, !Nomen; Tab(22); !PartNo; Tab(36); !TackNo

'Print the contents of the Remarks field on the second line
Print #1, !Remarks

Print #1, 'Print a third (blank) line to delineate the record

If Not .EOF Then .MoveNext
Loop
Close #1 'Close the text file.
.Close 'Close the recordset
End With

Set rst = Nothing
Set MyDB = Nothing

End Sub
************************************************** *********

--
--
HTH,
Don
=============================
E-Mail (if you must) My*****@Telus.net

Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code samples are also Access97- based
unless otherwise noted.

================================================== ========================
I was "anally raped" on a Timeshare deal by Club All Seasons
http://worf.usshurdman.com/~calgary/...id=26180&code=
, Les Volieres du Quebec, and Club Privilege.

In appreciation for that, please feel free to forward SPAM and VIRUSES to:
ch**********@bellnet.ca
ip*****@hotmail.com
in**@volieres.com

Don't get mad --- get even! :-)
================================================== ========================

"Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message
news:k4********************@comcast.com...
Hi and TIA! I have a query that I want to save as a fixed-width text file. I can get the export to work using an export specification with one exception. This is a government message and they need the remarks field to print on a separate line from the details section and I can' figure out how to get the remarks to start on a new line. So what I want is (Start Column & Width in parenthesis)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)

Is this possible? I've looked through all my literature and the NG, but have yet to come up with a solution. Any advice or pointers as to where I can look up more info is appreciated. As always, Thanks for your time!

--
Reggie

----------

Nov 13 '05 #3
cool! I like that solution and will have to remember that trick.

"Shane Suebsahakarn" <sh***@REMOVETHISgcicom.net> wrote in message
news:cg**********@titan.btinternet.com...
You could append a new line character(s) in front of the remarks field - in your query, change the field to a calculated field such as:

tRemarks: Chr(13) & Chr(10) & [Remarks]

Since Access will count the two characters as part of the field, you'll need to extend the field size in the specification to 52 characters though.

--
Shane Suebsahakarn
----
Head of IT
PAN Telecom
Tel: +44 (0) 870 757 7001

"Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message
news:k4********************@comcast.com...
Hi and TIA! I have a query that I want to save as a fixed-width text file. I can get the export to
work using an export specification with one exception. This is a

government message and they need
the remarks field to print on a separate line from the details section

and I can' figure out how to
get the remarks to start on a new line. So what I want is (Start Column
& Width in parenthesis)

Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)

Is this possible? I've looked through all my literature and the NG, but

have yet to come up with a
solution. Any advice or pointers as to where I can look up more info is

appreciated. As always,
Thanks for your time!

--
Reggie

----------


Nov 13 '05 #4
Shane, Works like a champ. Pretty cool. I just couldn't figure out how to get that CrLf
incorporated into the Spec. Now I know. Appreciate the help. Been kick'n my butt for a few days
now. Take care!

--
Reggie

----------
"Shane Suebsahakarn" <sh***@REMOVETHISgcicom.net> wrote in message
news:cg**********@titan.btinternet.com...
You could append a new line character(s) in front of the remarks field - in
your query, change the field to a calculated field such as:

tRemarks: Chr(13) & Chr(10) & [Remarks]

Since Access will count the two characters as part of the field, you'll need
to extend the field size in the specification to 52 characters though.

--
Shane Suebsahakarn
----
Head of IT
PAN Telecom
Tel: +44 (0) 870 757 7001

"Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message
news:k4********************@comcast.com...
Hi and TIA! I have a query that I want to save as a fixed-width text

file. I can get the export to
work using an export specification with one exception. This is a

government message and they need
the remarks field to print on a separate line from the details section and

I can' figure out how to
get the remarks to start on a new line. So what I want is (Start Column &

Width in parenthesis)

Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)

Is this possible? I've looked through all my literature and the NG, but

have yet to come up with a
solution. Any advice or pointers as to where I can look up more info is

appreciated. As always,
Thanks for your time!

--
Reggie

----------


Nov 13 '05 #5
Don, This works like a champ also just like Shane's advice above does. So many choices now I don't
know what to do with myself. Thanks much for your time!

--
Reggie

----------
"Don Leverton" <le****************@telusplanet.net> wrote in message
news:u0SWc.5605$A8.4438@edtnps89...
Hi Reggie

I think this will work for you...

************************************************** *********
Private Sub cmdExportQuery_Click()

Dim MyDB As DAO.Database
Set MyDB = CurrentDb
Dim rst As DAO.Recordset
Set rst = MyDB.OpenRecordset("qryReggie", dbOpenDynaset)

Open "C:\TEMP\TESTFILE.txt" For Output As #1 ' Open file for output.
'Note: The directory that will contain the text file (in this case
"C:\TEMP") must exist.

With rst
.MoveLast 'Populate the recordset
.MoveFirst
Do Until .EOF
'Print the contents of the first set of fields on the first line
Print #1, !Nomen; Tab(22); !PartNo; Tab(36); !TackNo

'Print the contents of the Remarks field on the second line
Print #1, !Remarks

Print #1, 'Print a third (blank) line to delineate the record

If Not .EOF Then .MoveNext
Loop
Close #1 'Close the text file.
.Close 'Close the recordset
End With

Set rst = Nothing
Set MyDB = Nothing

End Sub
************************************************** *********

--
--
HTH,
Don
=============================
E-Mail (if you must) My*****@Telus.net

Disclaimer:
Professional PartsPerson
Amateur Database Programmer {:o)

I'm an Access97 user, so all posted code samples are also Access97- based
unless otherwise noted.

================================================== ========================
I was "anally raped" on a Timeshare deal by Club All Seasons
http://worf.usshurdman.com/~calgary/...id=26180&code=
, Les Volieres du Quebec, and Club Privilege.

In appreciation for that, please feel free to forward SPAM and VIRUSES to:
ch**********@bellnet.ca
ip*****@hotmail.com
in**@volieres.com

Don't get mad --- get even! :-)
================================================== ========================

"Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message
news:k4********************@comcast.com...
Hi and TIA! I have a query that I want to save as a fixed-width text

file. I can get the export to
work using an export specification with one exception. This is a

government message and they need
the remarks field to print on a separate line from the details section and

I can' figure out how to
get the remarks to start on a new line. So what I want is (Start Column &

Width in parenthesis)

Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)
Nomen(1 - 21) PartNo(22 - 14) TackNo(36 - 15)
Remarks (1 - 50)

Is this possible? I've looked through all my literature and the NG, but

have yet to come up with a
solution. Any advice or pointers as to where I can look up more info is

appreciated. As always,
Thanks for your time!

--
Reggie

----------


Nov 13 '05 #6

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

Similar topics

205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
5
by: David | last post by:
I am a little confused by DB2 Backup and Export. I used "db2 backup db QAS to /dev/rmt0" backuping 650GB database to a IBM LTO 3581 (1 drive) only 11 hours. But I used "db2 export to /dev/rmt0...
3
by: Regnab | last post by:
Despite having at least 2 days VBA programming experience, this one has got me... I'm trying to export multiple tables into one worksheet in Excel. I've adapted code that I've got from this forum,...
0
by: JayDawg | last post by:
If anyone is willing to provide some consulting pro-bono, or for a very small charge I would really love the asistance. If anyone can fix my problem here online that would be even better. Here...
1
by: colleen1980 | last post by:
Hi: Can any one please tell me how to i export data thru VBA code as same when i right click on any table and then it ask me to export data as comma delimited. Can i do the same thru VBA code. I...
4
by: Grey | last post by:
i need to export the data set to excel in asp.net, but my requirement is need to use the template, i.e. some column should be lock as read-only and some column should be highlighted. the format...
3
by: cmdolcet69 | last post by:
What would be the easiest way to export a graphic (I have yet to determine what type of graphic, .jpg, bitmap....) however im open to suggestion, also how can i export my graphic so that it appear...
15
by: News | last post by:
Am having a problem usink AK2 exporting a report to an RTF file. The Access report has most fields and sections set to CanShrink and CanGrow. The report looks fine, but the ends of a number of...
1
by: ttfitz | last post by:
I have an application developed in Access 2000, to be distributed as an MDE. For those folks without Access, they install the free Access 2007 runtime. For the most part, this seems to be working...
2
by: rych | last post by:
I'm on Windows with VS2005 testing ctypes on a very simple dll I create a test.dll project which exports a function fntest(). I don't touch anything in the autogenerated source and build it. I can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.