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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export query to text file, formatting not correct 1

Status
Not open for further replies.

FancyPrairie

Programmer
Joined
Oct 16, 2001
Messages
2,917
Location
US
One of the fields in my query is defined as Double in the table from which the query gets its data. When I execute the query the numbers appear correctly. However, when I export the results of the query to a text file, the field now contains a decimal point followed by 2 zeros. How do I get rid of the decimal point?

Example: 123456 should read 123456 not 123456.00
 
Export a formatting query, ie use the Format function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I tried that. Several different ways. Please show me an example
 
Another possible way is to use the CLng or Int functions.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Tried that too. I don't know. Maybe my syntax is wrong. Please give me an example.
 
Maybe my syntax is wrong
Which syntax ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Here's a few of the things I've tried.

1. Select clng(ID) from....
2. Select cstr(ID) from...
3. Select Format(ID,"0") as ....
4. Select Format(ID,"####") as ...
 
Ok Here is what you do

Go into your Query in Design View Go to the very right to a blank field

Click your mouse in the top line (Where the Field Name Goes)

Click on the Build Tool on your tool bar (It's a wand with a bunch of dots under it)

Enter this line
FieldName2: Format([FieldName],"#######")

Where Field Name should be the Field name of the field your having formatting problems with

Click OK

Now click on the Exclamation point tool button - to run your query

You can now turn off the Show Button for Field Name and Just use the Value of Field Name 2 if you now try and export you will NOT have the decimal Place!!

Let me know if you have any trouble with this... I have to do this when I export out Dates to Text. I always get a 0:00 for the time which I DON'T want.

 
hext2003,

As you can see in my last post, I had tried that (Ex. 4 (Select Format(ID,"####") as...)). However, I went and tried it again and it worked. Don't know what I did wrong the first time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top