Re: Type mismatch
From: Ken Snell [MVP] (kthsneisllis9_at_ncoomcastt.renaetl)
Date: 01/11/05
- Next message: Eric Schittlipz: "Re: Checking for a database password"
- Previous message: anonymous_at_discussions.microsoft.com: "Type mismatch"
- In reply to: Alain: "Type mismatch"
- Next in thread: Alain: "Re: Type mismatch"
- Reply: Alain: "Re: Type mismatch"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 11 Jan 2005 10:14:01 -0500
The third argument of the DateAdd function must be a date data type. The
DateAdd function does not accept an SQL statement in any of its arguments.
You'd need to either get the query's result via a recordset or via the DMin
domain function, put that value into a variable, and then use that variable
in the DateAdd function.
Also, the SQL statement that you have posted will not work as you intend.
The Min aggregate function in SQL does not give you the minimum among
various fields; it returns the minimum value of a single field from the
selected records.
--
Ken Snell
<MS ACCESS MVP>
"Alain" <abilodeau@devencore.com> wrote in message
news:rAREd.24481$TN6.790978@news20.bellglobal.com...
> Hi,
>
> I am trying to create a function that need to return a date but getting
> the error 13 type mismatch in my select :
>
> Public Function ActivationDate(ActDateNotice As Date, IdBranch As Integer)
> As Date
> Dim temp As Date
>
> temp = "SELECT
> MIN(ExerDateNotice,ExerDateRenOption,ExerDateExpRights,ExerDateCanrights,ExerDatePurOption)FROM
> [General information] WHERE IdBranch = " & IdBranch
>
> ActivationDate = DateAdd("m", -12, temp)
> End Function
>
> From my understanding, it is something that has to be done with data type,
> I have tried different data type in the function even using everything as
> Variant but still getting the same error. The fields in the table are the
> correct type, date are short date and idbranch is a autonumber
>
> Can anyone tell me what I am doing wrong
>
> Thanks
>
> Alain
>
>
- Next message: Eric Schittlipz: "Re: Checking for a database password"
- Previous message: anonymous_at_discussions.microsoft.com: "Type mismatch"
- In reply to: Alain: "Type mismatch"
- Next in thread: Alain: "Re: Type mismatch"
- Reply: Alain: "Re: Type mismatch"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
Loading