Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating a Fixed width Flat File from an rs

Posted on 1998-10-06
2
Medium Priority
?
176 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
waty earned 400 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…
Suggested Courses

664 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