+ Reply to Thread
Results 1 to 2 of 2

excel - access query - date range

  1. #1
    Registered User
    Join Date
    01-30-2006
    Posts
    7

    excel - access query - date range

    I am trying to figure out how i can run an access query in excel and change the date range of the query without altering the query itself.

    i have written the query

    PHP Code: 
    SELECT Payments.idPayments.NamePayments.PaymentIDPayments.PaymentDatePayments.`ex vat`, Payments.`ex vat`*0.175 AS 'vat', (Payments.`ex vat`*0.175)+Payments.`ex vat` AS 'total'
    FROM table
    WHERE 
    (Payments.PaymentDate<={ts '2004-12-01 00:00:00'} And Payments.PaymentDate>={ts '2004-08-01 00:00:00'}) 
    and have managed to successfully import the data into excel. What is the easiest way to allow a date range to be added without the need to alter the query ie is it possible to pass variables to the query - so the query would be something like


    PHP Code: 
    SELECT Payments.idPayments.NamePayments.PaymentIDPayments.PaymentDatePayments.`ex vat`, Payments.`ex vat`*0.175 AS 'vat', (Payments.`ex vat`*0.175)+Payments.`ex vat` AS 'total'
    FROM table
    WHERE 
    (Payments.PaymentDate<= $end And Payments.PaymentDate>= $start 
    many thanks
    mxp

  2. #2
    Ron de Bruin
    Guest

    Re: excel - access query - date range

    hi mxp

    Look on this page

    You can use a cell with the date or see the example file where you can save different criteria.
    http://www.rondebruin.nl/accessexcel.htm

    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "mxp" <[email protected]> wrote in message news:[email protected]...
    >
    > I am trying to figure out how i can run an access query in excel and
    > change the date range of the query without altering the query itself.
    >
    > i have written the query
    >
    >
    > PHP code:
    > --------------------
    > SELECT Payments.id, Payments.Name, Payments.PaymentID, Payments.PaymentDate, Payments.`ex vat`, Payments.`ex vat`*0.175 AS
    > 'vat', (Payments.`ex vat`*0.175)+Payments.`ex vat` AS 'total'
    > FROM table
    > WHERE (Payments.PaymentDate<={ts '2004-12-01 00:00:00'} And Payments.PaymentDate>={ts '2004-08-01 00:00:00'})
    > --------------------
    >
    >
    > and have managed to successfully import the data into excel. What is
    > the easiest way to allow a date range to be added without the need to
    > alter the query ie is it possible to pass variables to the query - so
    > the query would be something like
    >
    >
    >
    > PHP code:
    > --------------------
    > SELECT Payments.id, Payments.Name, Payments.PaymentID, Payments.PaymentDate, Payments.`ex vat`, Payments.`ex vat`*0.175 AS
    > 'vat', (Payments.`ex vat`*0.175)+Payments.`ex vat` AS 'total'
    > FROM table
    > WHERE (Payments.PaymentDate<= $end And Payments.PaymentDate>= $start )
    > --------------------
    >
    >
    > many thanks
    > mxp
    >
    >
    > --
    > mxp
    > ------------------------------------------------------------------------
    > mxp's Profile: http://www.excelforum.com/member.php...o&userid=30994
    > View this thread: http://www.excelforum.com/showthread...hreadid=506755
    >




+ 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