Results 1 to 4 of 4
  1. #1
    MarcusAgthe is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    3

    Query to select sales within a certain intervall

    Hi folks,

    first of all: Sorry for my bad english. I try to explain myself as good as I can.

    I am working on a small databench problem.

    I have so far only a Customer table which shows me all the Sales of each customer and the sales date.

    Now I want to create a query which shows me all the sales within a certain period.

    I want to see all the sales until the last month and from 3years and one month ago on.

    So if we are in February, the query shall show me all sales from Januar 2013 to January 2016.

    I already have the formula for one of the conditions:


    YEAR([SalesDate])*12+DatePart("m";[SalesDate]=YEAR(Date())*12+DatePart("m";Date())-1

    It also works fine. If i put that formula into criteria than he shows me perfectly fine all the sales of January 2016.

    Now I want to tell him to show me also the sales of earlier then January 2016 but i cannot use less or equal signs in the criteria fiel...

    Does anyone have a solution to do it the proper way so it is showing me the sales until January 2016?

    I dont want to use concrete and precise dates within the formula as we need it on a regular base and i do not want to update the formula each month.

    I would be very glad for you help.

    Kind regards,
    Marcus

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Create a parameter query. In the Sales Date Field in your query in the QBE, type Between [type your start date here surround by #] and [type your end date here surrounded by #].When you run your query, the bold part in square brackets will appear for your user to complete.

  3. #3
    MarcusAgthe is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    3
    See below. Something changed.
    Last edited by MarcusAgthe; 02-25-2016 at 06:14 AM. Reason: situation changed

  4. #4
    MarcusAgthe is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    3
    Hi,

    thanks a lot for the quick response.
    I already thought about that but as I want to get to the query as quick as possible without typing in anything.

    If I understand you correctly i would have to type in the start and end dates...

    But since i am going to ask next month to show me the sales of 01 february 2013 to the 29 february 2016 then I would have to change it again...

    Or did I get you wrong?

    I now fixed it so far.

    Now I just need to tell the programme something:
    To give me just the sales of three years and one month ago. So if it is February 2016 he should give me all sales of January 2013. If it is March 2016 it should give me all sales of February 2013 and so on.

    How can I do it?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Sales Query - Please help!!
    By coccoster in forum Access
    Replies: 1
    Last Post: 05-24-2013, 09:20 AM
  2. Replies: 0
    Last Post: 12-13-2012, 03:18 AM
  3. Replies: 2
    Last Post: 11-24-2012, 01:16 PM
  4. Need help with Crosstab Query for sales
    By lorainguy in forum Queries
    Replies: 2
    Last Post: 04-05-2012, 05:00 PM
  5. Replies: 5
    Last Post: 06-30-2011, 02:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums