[QUOTE=Johnny L.A.]
That’s exactly what I need: 00000123 (or 0000123, depending on which column it’s in).
If the field is numeric, then it’s easy. If it’s not numeric (i.e., spaces, dots, commas, etc.) then I’ll have to write Easytrieve code (or, more truthfully, use the code I’ve already written – but that’s a lot of code) to parse each field from the right and only move numeric characters. I’ve got that in a Proc that I wrote years ago, but it’s quicker and easier if the fields are numeric already.
So how do I zero-fill the values in Access, keeping in mind that I’ve only used Access infrequently, years ago, and not to d othis sort of thing?
[/QUOTE]
Well, I don’t do the GUI version of things, I use the SQL window. And ACCESS isn’t completly ANSI compliant when it coems to things like this, but here goes (lowercase indicates your table, column, or whatever, all keywords are in uppercase) Also, this is going to require that you set your field properties to character fields instead of numeric, as numeric will simply drop those leading zeros:
UPDATE table SET column = RIGHT(“0000000000”+column,10)
This will accomplish my example above. Alter it to suit your purposes. Looking up the access syntax should be as simple as checking string functions in the help. IIRC, Access might use | instead of + to concatenate strings, and might make you use RIGHT$ instead of RIGHT or something like that.
Hope this helps…
ETA it might be better if you create an empty table for your new records and INSERT into it from the original table. To do that you would say:
INSERT INTO newtable SELECT RIGHT(“0000000000”+column,10)
FROM oldtable
To do this you will have to make sure you specify a value in your insert statement for each column in the new table, so either just move the fields as is or convert them using the syntax above.