By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Left Padding of "0" in String

overcomer
P: 25
Hi....

Please advise on how to create dynamic left padding for string... thanks to you..

Also, if anyone could add any idea of cascading combo box as it's not possible to setup rowsource in vba.

syntax for access 2003 can be ...

thanks so much
Nov 13 '08 #1
Share this Question
Share on Google+
2 Replies


missinglinq
Expert 2.5K+
P: 3,532
Padding a number with leading zeros can be done using the Format() function:

Format(YourNumericField, "0000")

8 will be returned as 0008, 12 as 0012 and so forth.

Note that Format() actually returns a string/text value. Access is often forgiving when dealing with this kind of thing. If, for example

YourNumericField

equals 10

and in VBA code you use the formula

NewNumber = Format(YourNumericField, "0000") * 12

Access will correctly calculate NewNumber as 120.

If you try to use

Format(YourNumericField, "0000")

and get an "Error 13 - Type Mismatch" error, wrap the function like this

Val(Format(YourNumericField, "0000"))

If anyone could add any idea of cascading combo box as it's not possible to setup rowsource in vba.
***Why*** can't you set the Row Source in VBA? It doesn't require a lot of code, but I know of no way to set up cascading comboboxes using no code at all.

Welcome to Bytes!

Linq ;0)>
Nov 13 '08 #2

overcomer
P: 25
Hi,

thanks for the reply... i already have the solutions for both questions... thanks a lot... :)
Nov 19 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.