+ Reply to Thread
Results 1 to 2 of 2

Microsoft Query: retrieve data by dates

  1. #1
    Raminhos
    Guest

    Microsoft Query: retrieve data by dates

    Hi,

    Firstly, let me say I don't know how to code. My question is this.

    I'm using Excel to query a Lotus Notes Database. I use Microsoft Query to do
    it and it works just fine when simply retrieving data.

    What I want to do is simply return data based on dates. I want records to be
    returned between the current system date and the current system date minus 8
    days.

    E.g. Return all records between
    (1) current system date 04/02/2005 and
    (2) current system date 04/02/2005 MINUS 8 days
    Expected result would be all records that have a date from and including
    04/02/2005 and 27/01/2005

    The SQL code that shows up in Microsoft query using the Wizard is this:
    SELECT Copy_Of_Closed_."_8"
    FROM Copy_Of_Closed_ Copy_Of_Closed_
    WHERE (Copy_Of_Closed_.Priority='0 - Critical') AND
    (Copy_Of_Closed_.CallType='P') AND (Copy_Of_Closed_.Status='Closed')

    This is without the date filtering. As for the " " around the 8 (i.e.
    Copy_Of_Closed_."_8"), I'm not sure why it does that, but it works!

    I'd really appreciate any help with this and this little tiny piece of code
    is stopping me from doing something really really simple!

    Many thanks in advance.

    Lena Gallagher



  2. #2
    Chris Ferguson
    Guest

    Re: Microsoft Query: retrieve data by dates

    Hi Lena

    Dates are funny things in msquery. Use criteria, select a date field, set
    the operator to greater than or equal to and in the value field enter
    [FromDate], add this criteria and without colsing the criteria form change
    the operator to less than or equal to and value to [Todate].

    Note the square brackets, these apparently tell the query that this is a
    variable, and are crucial.
    When you return the data you will be asked for values for fromdate and
    todate.

    It the spreadsheet you can amend the prameters to pick up the values for
    from and to dates from cells, I nomally use b1 and b2 with labels in a1 and
    a2 .

    Best of luck

    Chris
    "Raminhos" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > Firstly, let me say I don't know how to code. My question is this.
    >
    > I'm using Excel to query a Lotus Notes Database. I use Microsoft Query to
    > do
    > it and it works just fine when simply retrieving data.
    >
    > What I want to do is simply return data based on dates. I want records to
    > be
    > returned between the current system date and the current system date minus
    > 8
    > days.
    >
    > E.g. Return all records between
    > (1) current system date 04/02/2005 and
    > (2) current system date 04/02/2005 MINUS 8 days
    > Expected result would be all records that have a date from and including
    > 04/02/2005 and 27/01/2005
    >
    > The SQL code that shows up in Microsoft query using the Wizard is this:
    > SELECT Copy_Of_Closed_."_8"
    > FROM Copy_Of_Closed_ Copy_Of_Closed_
    > WHERE (Copy_Of_Closed_.Priority='0 - Critical') AND
    > (Copy_Of_Closed_.CallType='P') AND (Copy_Of_Closed_.Status='Closed')
    >
    > This is without the date filtering. As for the " " around the 8 (i.e.
    > Copy_Of_Closed_."_8"), I'm not sure why it does that, but it works!
    >
    > I'd really appreciate any help with this and this little tiny piece of
    > code
    > is stopping me from doing something really really simple!
    >
    > Many thanks in advance.
    >
    > Lena Gallagher
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1