How to extract date from personal ID number

Laimingasis

New member
Local time
Today, 10:32
Joined
Oct 4, 2006
Messages
4
Hello,

I would appreciate if someone could help on this problem.
What I want to do is to add a field in a form that would automatically show the date of person's birth after entering the persons ID. For example, I enter 39101012345. The first number (3) shows only the gender so I don't need it. The next 6 numbers show the date of persons birth - it is 910101 and it means that the birthdate is 1991.01.01
I need this field in a date format because later I will have to do some calculations concerned with the birthdate of that person.

Thanks in advance!

p.s. beer for help is quaranteed! :)
 
Don't need help, I already found a way how to do that :D
hiphip hurray!
 
text date

Darn, a little late...and I was hoping for that beer.....

For anyone else needing one solution to this:

if [textdate]=39101012345

Use a query

expr1: Mid$([textdate],2,6)
expr2: DateSerial(Left([expr1],2),Mid([expr1],3,2),Right([expr1],2))
expr3: Format([expr2],"yyyy\.mm\.dd")
 
Last edited:
Thanks! I knew how to do that in form but didn't know how to do that in query :) What I entered in form field to get the birth date is this:

=DateValue(IIf(Left([personal_ID];1)<5;1900+Mid([personal_ID];2;2) & "." & Mid([personal_ID];4;2) & "." & Mid([personal_ID];6;2);2000+Mid([personal_ID];2;2) & "." & Mid([personal_ID];4;2) & "." & Mid([personal_ID];6;2)))

Seems complicated, but..I'm happy it works :) B.t.w. IIF is used here because I had to distinguish which was the century when the person was born.
For example, we have ID: 3841203xxxx. The first digit "3" shows that the person was born somewhere in 19xx. When we have this ID: 6010203xxxx the first digit "6" shows that person was born somewhere in 20xx. On the whole, if we have ID starting with digits 3-4 it means that the birth date will be this 19xx.xx.xx, if the ID starts with 5-6 it means the birth date will look like this 20xx.xx.xx
I wonder how to do this checking in query? As far as I know IIF is used only in Update querys, isn't it?
 
well Rickster's solution works damn well without any IIF's :) I'm owing you beer, dude! :) Where should I send you a box of it?
 

Users who are viewing this thread

Back
Top Bottom