469,319 Members | 1,911 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,319 developers. It's quick & easy.

Left Padding of "0" in String

overcomer
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
2 88171
missinglinq
3,532 Expert 2GB
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
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.

Similar topics

11 posts views Thread by cjl | last post: by
6 posts views Thread by Dan | last post: by
8 posts views Thread by Ulysse | last post: by
2 posts views Thread by Angus | last post: by
1 post views Thread by manchin2 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.