Re: Calculating Difference In Time For Age



If the source date is coming in as text, you can parse it with Left(),
Mid(), etc, and convert it to a true date with DateSerial()

This example shows how to convert text such as "06/30/2005" into a true date
(assuming a field named "d"):
DateSerial(Right([d], 4), Mid([d], 4,3), Left([d],2))

You can use something like that in the query design window in Access. Either
type it into the Field row, or into the Update row to populate another true
date/time field. (Update on Query menu.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jeff C" <JeffC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E0BEA088-56E4-4BA4-B46A-774F89417825@xxxxxxxxxxxxxxxx
> Actually my problem is probably that I have not done anything with Doug's
> code listed in the article.
>
> Knowing that one of the Ten Commandments for Access users is to "Never Use
> Code" that you don't understand, and since I do not even know what to do
> with
> it (I might guess that I paste it into a new module and name the module
> Diff2Dates), I guess I am just going to be out of luck with this report I
> am
> creating.
>
> What I have is software which will print a report to a txt file of all the
> tests for the quarter (about 4000). Excel nicely opens this, I save it
> and
> then I import the data into an Access table. From there I can do alot of
> what I need, but I need the age of the neonate too, and I have found that
> the
> date and time for the two fields is imported as text, which I lose when I
> change the field design to Date/Time.
>
> "Allen Browne" wrote:
>
>> Access does not have a function to do that, but MVP Doug Steele has one
>> here:
>> http://www.accessmvp.com/djsteele/Diff2Dates.html
>>
>> "Jeff C" <JeffC@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:243494B0-75DA-439E-95C1-C9A6D45CD299@xxxxxxxxxxxxxxxx
>> >I am working on a report for a neonatal unit which requires the specific
>> >age
>> > of the newborns through a series of tests. I have two fields each
>> > holding
>> > a
>> > date and time, one field for the birth date and time...the second for
>> > the
>> > test date and time. They are formated as such: 7/10/2005 15:35.
>> >
>> > Can someone help me with a formula I can use as the control source of a
>> > text
>> > box in my report that will return the difference (age) in days, hours,
>> > and
>> > minutes? Thank You.


.



Relevant Pages

  • Re: Repost: Paper Size VBA Code
    ... You certainly earned the title of "MVP" ... the user has to open Page Setup and select Legal each time the report is ... > Hi Andy. ... This does not adjust the page size, but the user might be able to ...
    (microsoft.public.access.reports)
  • Re: Calculating Difference In Time For Age
    ... I guess I am just going to be out of luck with this report I am ... > Allen Browne - Microsoft MVP. ... >>I am working on a report for a neonatal unit which requires the specific ...
    (microsoft.public.access.reports)
  • Re: How conditionally skip stuff on a report?
    ... I'd like to know where these MVP Rules of Conduct are, ... How do I get the report to skip that ... like not wanting to see a blank line when there is no Address2. ...
    (microsoft.public.access.reports)
  • Re: Need report to only select the "yes" based on month
    ... is an MVP but notice it is not in Access. ... My report is based on a query and my table does have a CompanyName as well ... database to do to clarify so your table design can be further analyzed. ...
    (microsoft.public.access.gettingstarted)
  • Re: How conditionally skip stuff on a report?
    ... I'd like to know where these MVP Rules of Conduct are, ... alone with your first response without criticizing my response. ... Here's a direct quote from the OP - "How do I get the report to ...
    (microsoft.public.access.reports)

Loading