Re: Date Query



Thanks Eric, but the DateAdd function gave me the same wrong results as my
>Date()-n. But, alas, I did finally solve it. What I did was put in the
second bound column, the numbers 1, 8, 15, and 32 to correspond to yesterday,
last week, 2 weeks ago, and one month ago and then I referenced that number
in my >Date()-n function. Thanks for the help anyway.

"Eric D via AccessMonster.com" wrote:

> One Option:
> Redo your combo box, adding two columns - you can hide the second column.
> First column - as you have it now - lists the choices.
> Second colum - contains the DateAdd function for each item selected.
> Example:
> Yesterday would be - DateAdd("d", -1, Date())
> 1 week ago would be - DateAdd("ww"-1,Date())
>
> When the user makes a selection, pass column two to your query.
>
> Another Option:
> Stay with your current combo box but add code to define the DateAdd
> parameters to feed your query.
>
> Dennis A. wrote:
> >In Access 2003, I want to make a query that selects records based on a date.
> >I have a form with a combo box labeled: "All Records Since:" The choices are
> >Yesterday, One Week Ago, Two Weeks Ago, One Month Ago. Depending on which is
> >chosen, I want >Date()-2, >Date()-8, >Date-15, and >Date()-32 to be the
> >Criterion for the query.
> >
> >But I can't make it work. If I use the IIF function, the query returns no
> >records at all (maybe I'm writing it wrong). If I reference the bound column
> >on the form, Access says the expression is too complex to be evaluated.
> >
> >Can anybody help? I am open to doing it any old way at all, but I don't
> >know a whole lot of VBA.
>
>
> --
> Message posted via http://www.accessmonster.com
>
.



Relevant Pages

  • Re: Date Query
    ... adding two columns - you can hide the second column. ... Second colum - contains the DateAdd function for each item selected. ... When the user makes a selection, pass column two to your query. ...
    (microsoft.public.access.queries)
  • Re: Time Conversion
    ... Use the DateAdd function. ... You can use that formula whereever you need it. ... If you want you could use it in an update query that would populate an ... searches and groupings. ...
    (microsoft.public.access.queries)
  • Re: Please help!
    ... the DateAdd function into the query or where in the query to put it (to ... Allen Browne - Microsoft MVP. ... From the 2nd row down to the last is the same duplicate ... I use the DateAdd function? ...
    (microsoft.public.access.forms)
  • Re: Computing a Date in a Form
    ... Then use a multicolumn combo box that uses this as a query for the ... SELECT fldDays, TimeTermField FROM TableName; ... you could use the DateAdd function to get the new date from today's ... >><MS ACCESS MVP> ...
    (microsoft.public.access.forms)
  • Re: Scripting a query to run daily.
    ... CONVERT function to get the output of the DATEADD function into a format to ... Here is a query that uses these function to get ... The problem is that this report query needs to ...
    (microsoft.public.sqlserver.server)