Re: criteria and dates



kryszystof via AccessMonster.com wrote:
>i have a query, and i want to create an expression that depends on a date
>field.
>
>i have
>
>Field1 | Field2
>Date Expr
>
>field 2is such: adj1: iif([DateField] >= "01/01/2002",[do calculation], " ")
>
>i think it has to do with the date format that i am searching by, or possibly
>syntax?


Date values (as opposed to text strings) need to be enclosed
in # characters. In addition, you probably do not really
want to evaluate to a space character, or even a zero length
string when the date is before 1/1/02. I can't be sure from
your expression, but I think you want to use:

adj1: IIf([DateField] >= #1/1/2002#, [do calculation], Null)

--
Marsh
MVP [MS Access]
.



Relevant Pages

  • Re: execute append query
    ... copied sql from query into strings in vba in form, ... Dim qdfAppend as querydef ... > yes i did declare the parameter in the query and yes there was a suitable ...
    (microsoft.public.access.modulesdaovba)
  • Re: update table from form
    ... all my fields are text / strings and am trying to get form to update table ... as when get it to run query only updating first record. ... Dim stDocName As String ...
    (microsoft.public.access.formscoding)
  • Re: execute append query
    ... It may be that adding dbFailOnError to your original Execute statement would ... > copied sql from query into strings in vba in form, ... rather than allenbrowne at mvps dot org. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Working with tables in Excel 2007.
    ... The only way I've found to handle data tables is using the old ADODB ... only put strings in, and I can't read the index of the string selected, I ... colorful data table displayer in Excel '07, it works in Microsoft's Query ... can't make it work in the ADODB connector, where I can give it parameters ...
    (microsoft.public.excel.programming)
  • Access 2003 treats embedded functions in nested queries as a reference rather than a value - Acc
    ... Microsoft Access 2003 allows one to embed "expressions" in the query ... I also make extensive use of queries that are built from queries, ... Typically the IIf and Switch functions I use return strings. ... Has this behavior changed in Microsoft Access 2007? ...
    (microsoft.public.access.queries)