Calculating Age

music_al

Registered User.
Local time
Today, 22:38
Joined
Nov 23, 2007
Messages
200
Hi

I have been using a bit of code in a form to calculate the exact age from a Date of Birth control...

If IsNull(txt_DOB) Or IsNull(txt_Customer_ID) Then
Exit Sub
End If
txt_Age = DateDiff("yyyy", [DOB], Date) + (DateSerial(Year(Date), Month([DOB]), Day([DOB])) > Date)


It works fine on one computer, but for some unknown reason, when I run it on a different computer, I get this error (with Date highlighted)

Compile error:

Can't find object or library


Thanks in advance

Al
 
Possibly one of the references is missing. Open the code Window, then From the Tools menu check if any Refrences are marked as missing. If not try unchecking the DAO reference (DAO 3.51 or DAO 3.6 or if using 2007 format Microsoft Office Access Database Engine Object Library) and then closing the dialog and then opening and rechecking it again. I've found sometimes that helps (and if you don't have DAO but have ADO checked, even doing the ADO will sometimes help).
 
Hi

Thanks for that.

Ive now noticed that 2 references are missing...

Microsoft Office Project 12.0 Calendar Control
and
Microsoft Windows Common Controls-2 6.0 (SP6)


but how do I add them ?


Al
 
Thanks John

I later noticed that two of my refereences were in fact MISSING. I unchecked them and it fixed the problem.

I dont understand the mechanics behind it and why Access doesnt figure out the problem for itself.

Thanks again

Al
 

Users who are viewing this thread

Back
Top Bottom