Date Format in string variables

cdacey

Registered User.
Local time
Today, 02:05
Joined
Dec 11, 2002
Messages
68
Hi,

I am having a problem on something that seems very simple.

I have a query with three fields [last name] [first name] and [dateofbirth]

I created a string field to uniquely identify each person
[firstname]&[lastname]&[dateofbirth]

My problem is that even though the [dateofbirth] field is formatted mm/dd/yyyy and it's value in the base table is 01/01/2001, it changes to 1/1/2001 in the string field.

The [dateofbirth] field in the query shows as 01/01/2003, but the string converts it to 1/1/2003. I need the full 10 digit date to link this to another table.

Is there a way to ensure the string expression keeps the exact format and # of digits ?

Thanks Chris
 
[FirstName] & [LastName] & CStr([DateOfBirth])
 
Thanks

Mile

Thanks ! Thats what happens when you get real good at using access but no zero VBA.

Thanks again,

Chris
 
Spoke too soon

Mile,

I spoke to soon. Made the change and same result. It is very strange because the [dateofbirth] filed in the query is 10 digits. When I string it with the names it puts a short date format. Could it be a problem in an underlying table format ?

Chris
 
Other Ideas:

[FirstName] & [LastName] & CStr(Format([DateOfBirth], "dd/mm/yyyy"))

[FirstName] & [LastName] & Left([DateOfBirth], 2) & "/" & Mid([DateOfBirth], 4, 2) & "/" & Right([DateOfBirth, 2)
 
Mile

Your the Man ! The first one did it.

Thanks very much !

Chris
 

Users who are viewing this thread

Back
Top Bottom