1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Defining time and date queries in Access 2003

Discussion in 'Business Applications' started by cathing59, Nov 30, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. cathing59

    cathing59 Thread Starter

    Joined:
    Nov 30, 2011
    Messages:
    6
    Hi,
    I run a 24hour business and need to follow monthly trends in product
    sales. I would like to differentiate sales during regular hours (Mon-Fri, 8am -5pm) from non regular hours. How do I put that criteria in a query? I can do it for one day, but not those hours over an extended period. I am not techno savvy. Thank you.
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    cathing59, welcome to the Forum.
    Can you provide an example of the data and how you would like it?
    I would think a crosstab query would be what you need.
     
  3. cathing59

    cathing59 Thread Starter

    Joined:
    Nov 30, 2011
    Messages:
    6
    I want to track products, invoices and customers from tables I have. If I put all these tables into my query, but only want to display the invoices that were generated between 8am and 5 pm, Monday to Friday, I don't know how to set that up under the criteria.
     
  4. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Is there a date/time field to query against first of all.
     
  5. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You will need to split the Time out from the Date, have you already done that?
    You then need to convert the date to the day of the week, by adding a column like this

    dayofweek: Format([DATEADDED],"dddd")

    But use your date field name instead of DATEADDED
    and in it's Criteria enter

    Between "Monday" And "Friday"
     
  6. cathing59

    cathing59 Thread Starter

    Joined:
    Nov 30, 2011
    Messages:
    6
    Sorry, I'm stupid. How do you split the date and time apart?:confused:
     
  7. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    You can do it in a similar way to the days that I split out using
    Using something like this
    Time: Format([DATEADDED],"hh:mm")
    but using your Date/time field.
     
  8. cathing59

    cathing59 Thread Starter

    Joined:
    Nov 30, 2011
    Messages:
    6
    Sorry. This invoice table is populated in the date dd/mm/yyyy hh:mm:ss format. It is labelled Invoicedate. Am I changing it under the table, or under the query? Is this done under the Expression builder???
     
  9. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    This is done in a query and you don't need an expression builder.
    They are new Column headings.
    You just need to reproduce what I posted using your date field name instead of DATEADDED which is the name of the field in the database query that I tested it on.
    The Criteria can go in exactly as I posted in to your new dayofweek column.
    If you want to attach a zipped database with just your table with the date field in it I can do it for you. But I will have to go very soon.
     
  10. cathing59

    cathing59 Thread Starter

    Joined:
    Nov 30, 2011
    Messages:
    6
    You are amazing! I got it. Thank you! :)
     
  11. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1029094

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice