concatenate and Iif

razorking

Registered User.
Local time
Yesterday, 21:25
Joined
Aug 27, 2004
Messages
332
I have a problem I am working and and am not sure what the best approach is, hoping someone can lend me some insight:

I have two fields on a table:
SerialNumber....Location

I need to concatenate these two (no problem there). However my situation is such that my serial numbers vary in the number of digits. For example:
serial - 55124 (five digits)
serial - 552356 (six digits)
serial - 5514235625 (ten digits)

the serial number field is 10 characters and the serial numbers can be anywhere from one to ten in length (this is external data I am working with, not data I created)

When I concatenate the two fields I need the location value to always be in the same place, so if I have a location called - TEST - I need the end result of my concatenate query to place the location always after the tenth place of the serial number position, like this:
55124_____TEST
552356____TEST
5514235625TEST

(Without the underscores)

Don't ask me why...it's a long story.
 
Left(SerialNumber & Space(10), 10) & Location

^
 
That easy,

Thanks!
 

Users who are viewing this thread

Back
Top Bottom