Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Access Help

  • 24-02-2009 1:03pm
    #1
    Registered Users, Registered Users 2 Posts: 12,027 ✭✭✭✭


    I need help with Access queries and date functions.I'm required to do this and I would appreciate any help.

    The answer should display the startdate as a four digit year; as a numeric month and then a count of the projects.

    I think you use date part to get the year and month but the count doesn't work


Comments

  • Registered Users, Registered Users 2 Posts: 163 ✭✭stephenlane80


    Hi Titan,

    Post the table schema, and an sql version of the query so we can see whats going on,

    To get the query in sql view, right click it and go to sql view


  • Registered Users, Registered Users 2 Posts: 12,027 ✭✭✭✭titan18


    Hi Titan,

    Post the table schema, and an sql version of the query so we can see whats going on,

    To get the query in sql view, right click it and go to sql view

    SELECT tblProject.[Project Name], tblProject.[Start Date], tblProject.[End Date], tblProject.[Client Num], DatePart("yyyy",[Start Date]) AS [Year of Project], DatePart("m",[Start Date]) AS [Month of Project], Count(tblProject.[Start Date]) AS [Count of Projects in Month]
    FROM tblProject
    GROUP BY tblProject.[Project Name], tblProject.[Start Date], tblProject.[End Date], tblProject.[Client Num], DatePart("yyyy",[Start Date]), DatePart("m",[Start Date])
    HAVING (((tblProject.[Start Date])>#1/1/2007# And (tblProject.[Start Date])<#12/31/2008#))
    ORDER BY tblProject.[Start Date];



    Whats the table schema


  • Moderators Posts: 51,922 ✭✭✭✭Delirium


    titan18 wrote: »
    SELECT tblProject.[Project Name], tblProject.[Start Date], tblProject.[End Date], tblProject.[Client Num], DatePart("yyyy",[Start Date]) AS [Year of Project], DatePart("m",[Start Date]) AS [Month of Project], Count(tblProject.[Start Date]) AS [Count of Projects in Month]
    FROM tblProject
    GROUP BY tblProject.[Project Name], tblProject.[Start Date], tblProject.[End Date], tblProject.[Client Num], DatePart("yyyy",[Start Date]), DatePart("m",[Start Date])
    HAVING (((tblProject.[Start Date])>#1/1/2007# And (tblProject.[Start Date])<#12/31/2008#))
    ORDER BY tblProject.[Start Date];



    Whats the table schema

    You could try something like this.
    SELECT DatePart("yyyy",[Start Date]) AS [Year of Project], DatePart("m",[Start Date]) AS [Month of Project], Count(tblProject.[Start Date]) AS [Count of Projects in Month]
    FROM tblProject
    WHERE (((tblProject.[Start Date])>#1/1/2007# And (tblProject.[Start Date])<#12/31/2008#))
    GROUP BY DatePart("yyyy",[Start Date]), DatePart("m",[Start Date])
    ORDER BY DatePart("yyyy",[Start Date]) DatePart("m",[Start Date])  ;
    

    If you can read this, you're too close!



  • Registered Users, Registered Users 2 Posts: 12,027 ✭✭✭✭titan18


    koth wrote: »
    You could try something like this.
    SELECT DatePart("yyyy",[Start Date]) AS [Year of Project], DatePart("m",[Start Date]) AS [Month of Project], Count(tblProject.[Start Date]) AS [Count of Projects in Month]
    FROM tblProject
    WHERE (((tblProject.[Start Date])>#1/1/2007# And (tblProject.[Start Date])<#12/31/2008#))
    GROUP BY DatePart("yyyy",[Start Date]), DatePart("m",[Start Date])
    ORDER BY DatePart("yyyy",[Start Date]) DatePart("m",[Start Date])  ;
    


    thanks, that worked


  • Moderators Posts: 51,922 ✭✭✭✭Delirium


    titan18 wrote: »
    thanks, that worked
    No problem, glad it helped:)

    If you can read this, you're too close!



  • Advertisement
Advertisement