DateDiff/Format problem

Rats

Registered User.
Local time
Tomorrow, 01:38
Joined
Jan 11, 2005
Messages
151
I have been using the following code in a query to calculate age. It has worked fine in my Office 2k system with service pack 3. I have installed the database on other office 2k machines and had to upgrade to service pack 3 or else I received Undefined function "format" in expression errors. I was getting a "missing" on MS windows common controls 26.0 (SP4). I found if I copied mscomct2.ocx from my machine to theirs it worked.

I have now installed the program on a new Office 2003 Laptop with latest SP upgrade and mscomct2.ocx installed (by me). But the "undefined" error still comes up. I have checked all the Object Libraries and they are there except on the new computer they are all (11.0) where on mine they are (9.0).

Code:
age: DateDiff("yyyy",[dateofbirth],Now())+Int(Format(Now(),"mmdd")<Format([dateofbirth],"mmdd"))

Has anyone any suggestions please?
 
Hi Peter,

Is there anything in this link that helps?

By the way here's another age formula:
Code:
Public Function Age(DOB As Date) As Integer

Age = DateDiff("yyyy", DOB, Date) + (Date < DateSerial(Year(Date), Month(DOB), Day(DOB)))

End Function
It uses Date() rather than Now() since time has very little to do with age.
 
I don't know about that RG. If it's been a long "TIME" since you were born it's going to have a significant impact on your age. :)

I'll check that link. Thanks for the suggestion.
 
Moving DB to another machine

RG That link did help explain what was going on, Thanks. This does highlight the following problem:-
I am building a DB in A2k with data transfer to Excel. I have had to add a reference to the MS Windows Common Controls 26.0 (SP4). I need to be able to make the DB available to others and I have no control over the type of system they are running ie Office 2k, XP, 2003 etc. I have found in test runs on other PC's that I have had to ensure that they have the latest updates to Office 2k but I have also the need to add the above control to their references.
This is messy and I was looking for a automatic solution. Is it possible to write code that will check for references and add those that are missing?

Also I know that this is not a Excel forum but I have encountered a new message when using my project on a 2003 PC. When opening a Excel tabbed form containing a MS Office Spreadsheet Control I receive a message saying "This Application is about to initialize ActiveX controls that might be unsafe". I have researched Microsoft and found an article ID 827742 and attempted this fix unsuccessfully. (It involves changing Registry Key settings) This will also be a major problem when installing my application on 2003 machines. But I can't see how a fix to this can be automated if it involves changing Registry Keys.

Any thoughts or suggestions will be gladly accepted.
 
Last edited:
Hi Peter,

Here is a link that contains other links to resolve the References issue. It is not a simple problem to solve as you will discover.

I'll let others chime in on the security issues of ac2003. There are a number of threads on the subject and I for one do not plan to get ac2003 as a result.

P.S. You are correct that the water has been flowing under my bridge for quite some "TIME".
 

Users who are viewing this thread

Back
Top Bottom