forcing character length

rbemiller

Registered User.
Local time
Today, 03:18
Joined
Apr 17, 2002
Messages
14
I have the following control source of a text box on my report.

="*Z" & [Forms]![frmRcv]![identity_column] & "*"

This basically lets the ID number (identity_column) be read by a barcode scanner, and puts a Z in front of it. Works fine.

However, the system we're scanning it into requires that the identity_column be exactly 10 characters long. But our numbers are all from 1 to 4 characters long.

How can I force the length of the field to be 10 characters? Can someone show me how to do this with the above code?

Thanks
 
How do you want to Pad the bar code?

Leading Zeros: 0000001234
Trailing Zeros: 1234000000

Spaces?

Leading
="*Z" & Right("0000000000" & [Forms]![frmRcv]![identity_column],10) & "*"

Trailing
="*Z" & Left([Forms]![frmRcv]![identity_column] & "0000000000",10) & "*"
 
Thanks for your reply Travis.

I ended up figuring it out. I actually needed spaces between the Z and the ID number, not zeros. At any rate, the correct code follows:

="*Z" & Format([Forms]![frmRcv]![identity_column], "@@@@@@@@@@") & "*"
 

Users who are viewing this thread

Back
Top Bottom