Import a decimal type field

  • Thread starter Charles newbeginner
  • Start date
C

Charles newbeginner

I am trying to create a form with macros for a user to easily d some specific
text field deletion. One of the fields contains large (14-18) digit barcode
numbers. When I import as text I loose the order which MUST remain the same
as original file, When I try to export the table the numbers all have a .00
after the number. I have made sure all the number of decimal places is 0. The
only field property I have found that will leave my number alone is the
decimal type. This selection is not available during the initial import. If I
make the table's field property decimal before import, then the import
overwrites the table and I loose my settings. Is what I am trying to do not
possible or is there another way?
 
J

John W. Vinson

On Mon, 24 Dec 2007 15:55:00 -0800, Charles newbeginner <Charles
I am trying to create a form with macros for a user to easily d some specific
text field deletion. One of the fields contains large (14-18) digit barcode
numbers. When I import as text I loose the order which MUST remain the same
as original file, When I try to export the table the numbers all have a .00
after the number. I have made sure all the number of decimal places is 0. The
only field property I have found that will leave my number alone is the
decimal type. This selection is not available during the initial import. If I
make the table's field property decimal before import, then the import
overwrites the table and I loose my settings. Is what I am trying to do not
possible or is there another way?

These ARE NOT NUMBERS.

These are text values which happen to consist of the character set 0 through
9.

Store the data in the Text datatype with leading zeros and you'll get the
results you want.

John W. Vinson [MVP]
 
C

Charles newbeginner

I have done this as text and the sorting does not go well. Is this the reason
for using leading zeros? If so, how can I fill in the missing leading zeros
to fill in all fields to be, lets say, 16 digits/characters?
 
D

Douglas J. Steele

You can try the following Update query:

UPDATE MyTable
SET MyTextField = Right$(String(16, "0") & [MyTextField], 16)

If you want it to be a little more efficient, you could use

UPDATE MyTable
SET MyTextField = Right$(String(16, "0") & [MyTextField], 16)
WHERE Len(MyTextField) < 16

(Replace MyTable and MyTextField with the appropriate names)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)
 

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