Solved

Creating a Fixed width Flat File from an rs

Posted on 1998-10-06
2
171 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
ID: 1438401
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
ID: 1438402
Thanks I was trying to make this way to hard.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

861 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