Hi Danny,
Your handheld scanner file - could you post a few rows of data so we know
what kind of file you importing? Your description of what you are doing
makes it sound as if you will be doing this scanning and importing process a
lot. Be good to get it automated and reasonably bulletproof. If you have a
consistent file format that you will be importing a lot, it's often more
efficient, reliable to create a custom import function that 'knows' what
it's looking for, validates the data, does any formatting adjustments
required, and inserts it where needed.
Are you importing the file as a new table? Is it automatically creating
that column/field as a numeric type? Long probably?
If so, change the table (design view, table, find your UPC column, change it
to text with a length as long as you think you will ever need for a UPC
code.)
If you import your text file into an existing table, as long as the columns
in the text file are in the same ordinal (left to right) order as the table
and you have the same number of total fields/columns then this may resolve
the problem.
You have a fixed length UPC, is this correct? If you know how many
characters you are expecting the UPC to provide, then as a bandaid, you can
fix the column that is broken using an update query with contrived padding
function.
Assuming the name of the field is UPC, using the dummy table name TABLE and
the length you want is 15 - change the names and numbers to fit your needs.
UPDATE TABLE SET UPC = RIGHT(String("0", 15) &
.[UPC], 15);
Using a length of 3 to explain what this does...
Assuming you start out with 001 and it gets truncated to 1.
string("0",3) will return 000 and your file currently contains a 1.
Concatenating them (jamming them together into one string of text) gives you
0001. Now if we grab 3 chars counting from the right, we are back to 001.
if we had started with 011 and it went to 11. we build 00011, then grab the
right hand 3, we get 011.
If this seems obvious to you - I apologize for beating it into the ground.
The key here is you have to know how many characters you are expecting to
see.
Hope this helps,
Gordon