Re: Data Type mismatch error on a Time Calculation
- From: "Jeff Boyce" <JeffBoyce_IF@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 28 Aug 2005 07:50:58 -0700
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
.
- References:
- Data Type mismatch error on a Time Calculation
- From: charles w via AccessMonster.com
- Data Type mismatch error on a Time Calculation
- Prev by Date: Re: Access97 to Access2003
- Next by Date: Upsizing with picture data
- Previous by thread: Data Type mismatch error on a Time Calculation
- Next by thread: inported data in 20050131 format to a table how can i change to 1/
- Index(es):
Relevant Pages
|