Re: Data Type mismatch error on a Time Calculation

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Charles

By all means, first make a backup copy!

It sounds like one of your References may have gone MISSING. Open a code
module, click Tools | References and see if any are prefixed with MISSING.
Note which one(s), uncheck it/them, save and close, then reopen again and
re-check the box(es). Save, then uses Debug | Compile... and see if it
works.

Regards

Jeff Boyce
<Access MVP>

"charles w via AccessMonster.com" <forum@xxxxxxxxxxxxxxxxx> wrote in message
news:533C88FEF2765@xxxxxxxxxxxxxxxxxxxx
> Hello,
> I am trying to make a table that takes a client's Date of birth and the
> date/time of arrival and calculate an age. I have successfully used a
> function that calculates this data (from seperate tables) and posts the
> client age in a new table. I have used this function MANY times without
> incident. Now, I receive the data type mismatch error every time I try
this
> well used function. The tables, module, or fields have not been altered.
>
> In an effort to solve this problem, I have downloaded the latest MDAC
files
> with no success. I'm stumped. Any help would be welcome!
>
> Here is the VBA for the module....
>
> Function AGE(VarBirthdate As Date, VarAdate As Date) As Integer
> Dim VarAge As Variant
> If IsNull(VarBirthdate) Then AGE = 0: Exit Function
> If Not IsDate(VarBirthdate) Then AGE = 0: Exit Function
> If Not IsDate(VarAdate) Then AGE = 0: Exit Function
> VarAge = DateDiff("yyyy", VarBirthdate, VarAdate)
> If DateSerial(Year(VarAdate), Month(VarAdate), Day(VarAdate)) < DateSerial
> (Year(VarAdate), Month(VarBirthdate), Day(VarBirthdate)) Then
> VarAge = VarAge - 1
> End If
> AGE = Val(VarAge)
> End Function
>
>
> Here is the SQL for the query:
>
> SELECT EMSTAT_ARCHIVE_ACUITY.DESCRIP, EMSTAT_ARCHIVE_CHART.CHRTNO, AGE(
> [EMSTAT_ARCHIVE_PATIENT]![DOB],[EMSTAT_ARCHIVE_CHART]![ARRVDATE]) AS
AGEPT,
> EMSTAT_ARCHIVE_CHART.ARRVDATE, EMSTAT_ARCHIVE_CHART.DSCHDATE INTO
[tblAcuity-
> Pedi]
> FROM EMSTAT_ARCHIVE_PATIENT INNER JOIN (EMSTAT_ARCHIVE_CHART INNER JOIN
> EMSTAT_ARCHIVE_ACUITY ON EMSTAT_ARCHIVE_CHART.ACUITY =
EMSTAT_ARCHIVE_ACUITY.
> CODE) ON EMSTAT_ARCHIVE_PATIENT.PTNTID = EMSTAT_ARCHIVE_CHART.PTNTID
> WHERE (((EMSTAT_ARCHIVE_CHART.ARRVDATE) Between #1/1/2003# And
#7/1/2003#))
> GROUP BY EMSTAT_ARCHIVE_ACUITY.DESCRIP, EMSTAT_ARCHIVE_CHART.CHRTNO, AGE(
> [EMSTAT_ARCHIVE_PATIENT]![DOB],[EMSTAT_ARCHIVE_CHART]![ARRVDATE]),
> EMSTAT_ARCHIVE_CHART.ARRVDATE, EMSTAT_ARCHIVE_CHART.DSCHDATE
> HAVING
(((AGE([EMSTAT_ARCHIVE_PATIENT]![DOB],[EMSTAT_ARCHIVE_CHART]![ARRVDATE]
> ))<22));
>
> PS: DOB is in a Short date format, ARRVDATE is in "mm/dd/yyyy hh:mm"
>
> Thanks agian!
>
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/200508/1

.



Relevant Pages

  • Re: 3vl 2vl and NULL
    ... >>>someone whose age (in this database) is less than or equal to Marge's ... >Uncle Henry's age is unknown ... the handling of missing data changes as well. ...
    (comp.databases.theory)
  • Storing object references in hashes
    ... correct references to the object, using these references to address the ... Kathryn, Age: 28} ...
    (comp.lang.perl.misc)
  • Re: Ancestry.co.uk BMD
    ... were missing will remain missing so your only chance of finding a ... particular event would be to go to the relevant register office. ... The age at death will be included from 1837 to 1866. ... reconstructed indices the more chance I'll have - assuming he really ...
    (soc.genealogy.britain)
  • Re: Date, Darwen, Pascal and the alternative to Nulls in the RM
    ... , name, age grade) ... now in a logically consistent system, a query for soc, name, grade ... The missing entry for 'joe' in the last query might be very difficult ...
    (comp.databases.theory)
  • Re: Am I missing something?
    ... Don't exclude the possibility that that the age on the index may be wrong. ... Being new to Ancestry.co.uk is it common for some records to be missing? ... Depends upon which resource you are using at Ancerstry. ... Don't rely on the age on the marriage certificate being correct, ...
    (soc.genealogy.britain)