Results 1 to 6 of 6
  1. #1
    BigFishCA is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    3

    Pulling records with from last month w/ start end dates

    Hello, I'm trying to make a query criteria that returns a record of a class taking place during the span of last month that fall between a start and end date that do not contain last month's information. For example I have a class that started in February and will end in July. This class took place within last month (may). I can pull the record that begin within last month (dates containing may) and end within last month.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    make a form with 2 text boxes, txtStart, txtEnd
    then the query will use them,

    select * from table where date between forms!myForm!txtStart and forms!myForm!txtEnd

  3. #3
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2016
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    What fields are in your table. Which field(s) are you attempting to query. Your explanation is unclear. Try again to explain it more clearly.

  4. #4
    BigFishCA is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    3
    I have a class name, class start date, class end date, how many students are in the class. My issue lies in returning the classes that were taught last month (may) where the start dates and end dates do not contain specific mention of may. For example I have a class that begins in February and ends in June. No mention of May in those dates, yet the class was in session during may. I want to include that clad in my results. I currently can return class records that have start dates such as may 2 and those that end in May. I thought about averaging the dates and finding a midpoint, however, this isn't always accurate. Although the midpoint may sometimes result in a date within the month of May there may be times were it may not. My thought process is extracting the month values of the start date and end date, then, depending on when I run the query the value of last month is calculated and used to check if it falls between the start and end date. Hope that explains it better.

  5. #5
    BigFishCA is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    3
    This query is used to populate a report to summarize the classes and students taught during the month of May. The month of May is subjective to when I run the report. Next month it'll return values for June and so forth. I'm currently using the criteria of " Year([START])* 12 + DatePart("m", [START]) = Year(Date())* 12 + DatePart("m", Date()) - 1" to select the records with start dates that contain dates for last month. The same for end dates.

  6. #6
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Why May? What about March or April?
    This may be as simple as getting the classes with Null as the end date (if there isn't one, it's still running). Unless you have hours/attendance/room data/something that relates to that class that was recorded for May, I see no way of retrieving records for just May. If that's what you want, and you have no such data for May, then you probably have a design problem. I just don't see how your posted expression could help since the dates you're trying to use don't have any relationship to May (or any other month that happens to fall between them), plus as you've indicated, there's no end date anyway for a class that's still being conducted.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 5
    Last Post: 03-16-2016, 07:54 PM
  2. criteria with start date as month and year
    By louise in forum Queries
    Replies: 3
    Last Post: 12-18-2015, 11:10 AM
  3. Add date to table at start of each month
    By DubCap01 in forum Access
    Replies: 7
    Last Post: 06-20-2015, 01:54 AM
  4. Replies: 3
    Last Post: 03-01-2014, 10:38 AM
  5. List Dates between Start and Finish Dates
    By Buddus in forum Queries
    Replies: 1
    Last Post: 07-26-2013, 01:58 PM

Tags for this Thread

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