downsizing fields/ field length

S

svet

Hello,
I need to import data into intereg field in Access but
would like to trim the lenght of the field to 4 char. long
instead of the default six char. long. This is important,
because on export, I need to export the data into fixed-
width format, and the lenght of the integers cannot be
more the 4 chars long.
Is there a way to change the default to 4 chars long?
Although the field can be formatted to display as shorter,
on export the stored lenght of the field is used, which is
6 chars long.
 
J

John Vinson

Hello,
I need to import data into intereg field in Access but
would like to trim the lenght of the field to 4 char. long
instead of the default six char. long.

An Integer has no count of characters for its length; it is NOT stored
as decimal digits! It's stored as a 2-byte (Integer) or 4-byte (Long
Integer) binary number. The characters "312" are generated from this,
not stored.
This is important,
because on export, I need to export the data into fixed-
width format, and the lenght of the integers cannot be
more the 4 chars long.

Create a calculated field in the Query from which you are exporting:

ExpNum: Format([numberfield], "0000")
 
S

svet

Thanks for the respose, but this solution will not work.
When I use Format() funciton, from 99 my data converts to
0099 which is undesirable.
I sinply need to export the integer field with width 4
char. instead of 6. (max value in the field is 999).
The data is used in scientific computation, and the
program will not accept a width of the field more then 4
chars.
It is possible to change the width inthe Export wizard,
but that means that the user has to change 50-60 field
widths every time she needs to export data.
Is there a better solution?

-----Original Message-----
Hello,
I need to import data into intereg field in Access but
would like to trim the lenght of the field to 4 char. long
instead of the default six char. long.

An Integer has no count of characters for its length; it is NOT stored
as decimal digits! It's stored as a 2-byte (Integer) or 4- byte (Long
Integer) binary number. The characters "312" are generated from this,
not stored.
This is important,
because on export, I need to export the data into fixed-
width format, and the lenght of the integers cannot be
more the 4 chars long.

Create a calculated field in the Query from which you are exporting:

ExpNum: Format([numberfield], "0000")



.
 
S

svet

Duane thanks!
I already tried that, but at export the field is still 5
chars long, instead of 4. When you use any formula to
format a number field, the filed is converted to 5 chars
long, no matter what type of field it is (binary, byte,
ect.)
What else can I do...formatting teh colums with
expressions does not work!

-----Original Message-----
Use a query as suggested by John but set the column to
ExpNumField:Right(" " & [NumberField],4)

--
Duane Hookom
MS Access MVP


Thanks for the respose, but this solution will not work.
When I use Format() funciton, from 99 my data converts to
0099 which is undesirable.
I sinply need to export the integer field with width 4
char. instead of 6. (max value in the field is 999).
The data is used in scientific computation, and the
program will not accept a width of the field more then 4
chars.
It is possible to change the width inthe Export wizard,
but that means that the user has to change 50-60 field
widths every time she needs to export data.
Is there a better solution?

-----Original Message-----
On Thu, 4 Sep 2003 07:00:20 -0700, "svet"

Hello,
I need to import data into intereg field in Access but
would like to trim the lenght of the field to 4 char. long
instead of the default six char. long.

An Integer has no count of characters for its length;
it
is NOT stored
as decimal digits! It's stored as a 2-byte (Integer)
or 4-
byte (Long
Integer) binary number. The characters "312" are generated from this,
not stored.

This is important,
because on export, I need to export the data into fixed-
width format, and the lenght of the integers cannot be
more the 4 chars long.

Create a calculated field in the Query from which you
are
exporting:
ExpNum: Format([numberfield], "0000")



.


.
 
J

John Vinson

Thanks for the respose, but this solution will not work.
When I use Format() funciton, from 99 my data converts to
0099 which is undesirable.

Hrm. Try

Right(Format([numberfield], "#"), 4)

I'm really surprised that the number 3 exports as anything other than
"3" - what are you seeing? " 3"?
 
S

svet

I see " 3", which is a 5 char long field. That occurs
only in fixed format export files. In delimited files it
is not a prob, but I need fixed format. The manual says
that at export, the actual stored length of the field is
used, insted of the formatted one (from a formula). So I
need to restrict the physical length of the field (I
think).
The export utility is EXTREMELy cumbersome and unfit for
fixed files exports.


-----Original Message-----
Thanks for the respose, but this solution will not work.
When I use Format() funciton, from 99 my data converts to
0099 which is undesirable.

Hrm. Try

Right(Format([numberfield], "#"), 4)

I'm really surprised that the number 3 exports as anything other than
"3" - what are you seeing? " 3"?



.
 

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