Solved

Write to textfile problem

Posted on 2004-08-24
5
219 Views
Last Modified: 2010-05-02
Hi,

this is the problem I have:

I wrote a little program to write some data to a textfile.

Open "g:\transfer\convertedADBsap.txt" For Output As #1
...
Write #1, strDatum & strKey & strDescription
...
Close #1

This program works great but when I look in the created textfile(with notepad) I see:

"20040731 1 test"

I would like to become 20040731 1 test without the " ".  Is this possible? Suggestions?

Thanks
0
Comment
Question by:gollem
[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
5 Comments
 
LVL 18

Expert Comment

by:JR2003
ID: 11880237
Write #1, Trim(strDatum) & Trim(strKey) & Trim(strDescription)
0
 
LVL 8

Accepted Solution

by:
mladenovicz earned 50 total points
ID: 11880238
Open "g:\transfer\convertedADBsap.txt" For Output As #1
Print #1, strDatum & strKey & strDescription
Close #1
0
 
LVL 18

Expert Comment

by:JR2003
ID: 11880253
Sorry I misunderstood.

Dim strText as String
strText = strDatum & strKey & strDescription
strText = Right(strText, Len(strText) - 1)
strText = Left(strText, Len(strText) - 1)
Write #1, strText
0
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 20 total points
ID: 11880273
Yes it's possible:

Write places strings in double quotes, separates values with commas, and adds a CR/LF pair at the end of each command. Read the data back with Input.

Print does not add extra delimiters, but does concatenate a final CR/LF to each line. The CR/LF can be suppressed by ending the command with a semicolon (;). (This trick has been available in every Basic I've used, but it is not documented in the VB 6.0 Help.) Read it back with Line Input. (Line Input assumes a DOS type ASCII input file where each line is terminated with CR/LF. It does not recognize the unix line termination character.)

Print #1, strDatum & strKey & strDescription ;
0
 

Author Comment

by:gollem
ID: 11880408
Hi,

thanks guys exactly what I needed.  I'll give the points to mladenovicz because he had the fastest solution first, but I'll add 20 points for dhaest for his great comment.

JR2003 I've tested your solution but I still get " " in my textfile.

The print statement was the key I needed.

Thanks again for your time and quick reply.

Gollem
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Suggested Courses
Course of the Month5 days, 19 hours left to enroll

627 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