Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

output text as a space-delimited file--$4.57 = 000000457 1

Status
Not open for further replies.

tedmillerx

Programmer
Jan 6, 2001
52
US
I need to convert data for output from standard currency, dates and other types of fields into a format that has zeros. For example:
$4.57 outputs to 000457
12/24/99 outputs to 00122499
etc.
I need to output them in a fixed width file format. Can anybody help?
 
Hi tedmillerx,

For the Date field you could use

"00" & Format([DateField],"mmddyy")

For currency

Format(([CurrField]*100),"000000")

What are the others?


 
Cascot,

Very useful. How would you do pipe-delimited output for a date MM/YYYY & DD/MM/YYYY??

In addition, what would you have to do for the whole output to be pipe-delimited? For example, the output would have to look like this:

DD/MM/YYYY|Phone Number|Number of Messages between Monday to Sunday of Previous Week

Any help would be great. Thankyou (or anyone) in advance.
Matt

 
Hi,

You could try the following to obtain a piped output:


Format(dateInQuestion,"dd/mm/yyyy") & "|" & phoneNumberInQuestion & "|" & numberOfMessagesInTheLastWeek

You can just concatenate all that you want so that it is in the format that you want. Now you can store it in some text field.

Let me know what happens.
With regards,
PGK
 
Hi there! CVigil here.

Also, if you're prepared to do some programming in Visual Basic (VBA)...

If you want to output to a text file, but need to write your own output routine (i.e. if the standard built-in export functions won't do what you want or need), then check Visual Basic help for the following *statements*:
Open
Close
Print #
Input #

These will probably also lead you to other useful statements, functions, and generally useful things that will help you in outputting to text files for yourself. Also check out the following *functions*:
Tab
Spc
Space
String
as well as any formatting and string-/text-related functions that will help you in your formatting before writing to a text file.

. . .

One other option is to (somehow) get all the text you want, formatted just-so (as you please), into a table and export that to a text file.

Well, I've got to run, but this -- along with the previous answers -- should help you in the right direction. -- C Vigil =)
(Before becoming a member, I also signed on several posts as
"JustPassingThru" and "QuickieBoy" -- as in "Giving Quick Answers")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top