Full Version: Exporting question
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
DirtyShirt
My head hurts from beating it against the monitor.
I'm trying to export a query to excel where it gives me a listing for a code, water, sewer, and account# and the water and sewer have to be 8 digits with leading 0's from a date span which I have working great thanks to the :notworthy HEROS :notworthy in this forum. Now my question is: Is it possible to get a total of the water and sewer amounts which have to be "text" so it doesn't truncate an amount that may be a even dollar amount? Does this make and cents to you?
I've posted the database to http://www.littlebitcountry.com/what_a_mess.zip it's 981K in size for anyone that could help me.

Thanks
Dave
fkegley
Yes, that can be done, I believe, you'll need a query that converts the appropriate amounts to TEXT like this

TextValue: CStr([FieldName])

Then uses the String$ function to pad with the required number of zeros:

ExportValue: String$(8 - Len([TextValue]), "0") & [TextValue]

Then export the query to Excel. Use the Value function to convert the TEXT numbers to their equivalent numeric values. Then Sum those values.
HiTechCoach
I like to use the format function.

Example for length of 8 with leading zeros:

Format([YourField],"00000000")
DirtyShirt
Got it working with the Format([YourField],"00000000")
I need a few more books on Access. the ones I have are for 95 and 97, so I just bought some on Ebay for 2003.

You folks are my notworthy.gif HEROS notworthy.gif

Thanks
Dave
HiTechCoach
You're welcome!

Glad we could assist.

uarulez2.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.