exporting number fields

J

Jim

I started this morning doing a job I thought would be quite simple:

Export a table that contained Decimal data right justified with 2
decimal places. Wrong. thank you Mr. Gates, you can't export decimal
fields. So I CDBL. No Problem. I Format Fixed (thanks to the forum).
And I right justify (Left(" ",trim(len(fieldName))) &
trim(fieldName). All that works.

SO NOW I try to export this beauty and it assumes my nicely formated
text fields are all 255 bytes long.

How do I get them all to be 14 bytes long?

Even if I trim again, the default field size is 255. :-(

thanks
Jim
 
J

John Vinson

Export a table that contained Decimal data right justified with 2
decimal places. Wrong.

What you can do is create a calculated field using the Format()
function, and export *that*:

ExpNumber: Format([DecimalField], "#.00")

John W. Vinson[MVP]
 
J

Jim

Right but that calculated text field has a default field size of 255,
I've got 5 of those fields...

John said:
Export a table that contained Decimal data right justified with 2
decimal places. Wrong.

What you can do is create a calculated field using the Format()
function, and export *that*:

ExpNumber: Format([DecimalField], "#.00")

John W. Vinson[MVP]
 
J

John Vinson

I started this morning doing a job I thought would be quite simple:

Export a table that contained Decimal data right justified with 2
decimal places. Wrong. thank you Mr. Gates, you can't export decimal
fields. So I CDBL. No Problem. I Format Fixed (thanks to the forum).
And I right justify (Left(" ",trim(len(fieldName))) &
trim(fieldName). All that works.

SO NOW I try to export this beauty and it assumes my nicely formated
text fields are all 255 bytes long.

How do I get them all to be 14 bytes long?

Even if I trim again, the default field size is 255. :-(

thanks
Jim

Are you exporting to another Access database? Bear in mind that Access
doesn't store trailing blanks so you aren't actually wasting any
space...

AFAIK creating a table (with either a MakeTable or an Export) will do
this; what I'd recommend is exporting into a pre-built empty table,
with field sizes, formats, data types, defaults, indexes etc. all
defined already.

John W. Vinson[MVP]
 
J

Jim

Silly me! The export function allows you to specify the start and width
of the exported .txt file!! So all I had to do was specify a spec that
reflected the field lengths I need not the default 255 length. NO
PROBLEM.

I have created the table as you suggested but this solution is far
superior I believe.

thanks again for the help.

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top