Results 1 to 4 of 4
  1. #1
    junction is offline Novice
    Windows Vista Access 2003
    Join Date
    Jan 2011
    Posts
    13

    Costings by day query

    I'm currently putting together a database which shows out of hours costings per day.

    The date is input into a table with a start time and end time. An hourly costing is then calculated (ie 3hours at £20ph = £60)

    The problem I have is that the costing is different at a weekend (£20 per weekday, £30 at weekend)



    I have an expressions which recognises the date and gives me the day of the week (DayOfTheWeek: Format([MyDate],"dddd")) and a table with all the days of the week and the rate per day (ie Monday - Friday £20, Saturday & Sunday £30)

    What I want the query to do is use DayOfTheWeek: Format([MyDate],"dddd"), give me the day (which works) and the rate (which doesn't work)

    Any ideas?

    Copy of the database is attached

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The nature of the join will force this to be edited in SQL view, but does this do what you want?

    SELECT Format([MyDate],"dddd") AS DayOfTheWeek, EmpDates.MyDate, Day.Day, Day.Amount
    FROM [Day] INNER JOIN EmpDates ON Day.Day = Format(EmpDates.MyDate, "DDDD")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    junction is offline Novice
    Windows Vista Access 2003
    Join Date
    Jan 2011
    Posts
    13
    Thanks Paul. That's perfect.

    Is there anyway of getting this to show in Design View?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I think it may show, but design view can't represent the join, so it will warn you. You may be able to work with it in design view. I typically set up the basic query in design view, then switch to SQL view and change the join. From then on, I work in SQL view if I need to tweak something.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

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