Full Version: Concatenate with Leading Zeroes
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
elcentro3m
I've got three number fields, imported from an online database.

One for Birthmonth

One for Birthday

and

One for Birthyear

Before I give up, is there any way in a query
to convert:

7/6/2006

for example, to:

07/06/2006

??

Since they come over as numbers, I'd just as soon
keep them numbers and convert them programmatically.

I've tried formatting the fields to "00".

I've tried converting them to strings using 'CStr'

and

I've tried using IIf constructs based on length

and

'Format' in the query.

Anyone?

Thanx.
dannyseager
try

format(dateserial([YearField],[MonthField],[DayField]),"DD/MM/YYYY")

or "MM/DD/YYYY" if you want american format
Alan_G
In a new field in your query, try

MyDate:Format([Birthday] & " " & [Birthmonth] & " " & [Birthyear],"dd/mm/yyyy")
elcentro3m
That worked.

Thanx.

(Both of you)
Alan_G
You're welcome - glad we could help
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.