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)>