Solved

Creating a Fixed width Flat File from an rs

Posted on 1998-10-06
2
167 Views
Last Modified: 2010-04-30
Greetings,
I have just been assigned a little project which I haven't experinced yet and was looking for some ideas. I need to take some files (could be excel, csv etc) proabably import them to a db and from a recordset map them to a 200 column fixed witdth file, ie at 1-6 field A, 7-10 field B, 11-17 field C, etc.

Has anyone ever done this before? If so how do I code for the fixed width fields when creating an ASCII text file.

Thanks in advance.
BRad
0
Comment
Question by:bhummel
2 Comments
 
LVL 14

Accepted Solution

by:
waty earned 100 total points
Comment Utility
When you will write to the output fixed file, you have to use the format fucntion :

sSQL = "Select * from yourTable"
set record = DB.Opnrecordset(sSQL, dbOpenDynaset)

Do while record.EOF = False
  sLine = Format(record("fieldA"), "@@@@@@")
  sLine = sLine & Format(record("fieldB"), "@@@")
  sLine = sLine & Format(record("fieldC"), "@@@@@@")
.

  ' *** Print to your file
  print #nFile, sLine

  record.MoveNext
loop
0
 

Author Comment

by:bhummel
Comment Utility
Thanks I was trying to make this way to hard.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now