Full Version: Format Leading Zero's on check form
UtterAccess Forums > Microsoft® Access > Access Forms
wislndixie
I've created a "business check" form and it's perfect except I can't get the leading zero's in the routing number and account number to format correctly. I've got both fields in my table and I want the correct routing and account number to be the "default value". When I type in the following number 001234567 the number gets shortened to 1234567 and that's how it appears on the form also, without the leading zero's. I've even tried formatting the form fields themselves but no luck. I'm sure I'm missing something. Can someone help?
Mike
When I formatted the fields in my table and form I used the following: 0000000000 in the format field.
Blackhand
change recordsource to:
=Format([fieldname], "0000000000")
at least i think that will work without actually trying it.
You wont see the leading zeroes when that field has the focus, but they will be there the rest of the time.
BH
HiTechCoach
Since you will not need to do math with these values, I would change the data type to text in the table and not use a numeric data type. Then your problem is solved.

Are you also using a MICR font to print this information? I have found that already storing as text makes this easier.
Blackhand
Boyds solution is ideal... my solution is esentially displaying the number field as a string as well.
The only disadvantage to Boyd's solution is if you have used the account number or transit number elsewhere you may have to sort out datatypes across a number of tables, forms, reports etc... and if they are part of a relationship you may have to delete the relationships change the datatype and then remake the relationships.
So, to reiterate, Boyd's is the most sensible solution, but depending on your databse structure, mine may be easier and give you the same end result.
BH
wislndixie
Your format suggestion worked perfectly.
Thanks
wislndixie
I tried Boyds suggestion and had my two fields in question set up as text fields in my table as well as the form control. But, each time I would put the acct and routing numbers in the default value of my table, the zeros disappeared and they didn't show up on the form.
The first suggestion worked fine as I need the same numbers on all checks.
I did I miss something on setting them as text fields?
Mike
Blackhand
when you changed the datatype did you renter the format property in the table and form controls?
wislndixie
Yes, the format property was set to 000000000
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.