View Full Version : Keeping zeros in place


Dave_cha
08-07-2003, 10:26 AM
I have a 4 digit number field which I want to preceed with the current year to form a unique reference. When I combine, for example, 2003 with 0123 I'm getting 2003123. The zero has been dropped . Anyone know how I can avoid the zero being dropped?

sofar...

DIM Numfield as string
Numfield=dlookup("[Numfield]","Number table", "[Year]=" & (DatePart("yyyy", Date)))
[Forms]![Myform]![Myfield] = (DatePart("yyyy", Date)) & Numfield

[Numfield]'s formatting within the number table is '0000'

Thanks,

Dave

fuzzygeek
08-07-2003, 11:11 AM
The formatting on the field is for visual only, not the way the data is stored. Try this

= (DatePart("yyyy", Date)) & Format(Numbfield, "0000")

Dave_cha
08-08-2003, 01:29 AM
Thanks Fuzzy