www.webdeveloper.com
Results 1 to 3 of 3

Thread: Need Help Filtering Month from Date/Time

  1. #1
    Join Date
    Oct 2006
    Posts
    3

    Need Help Filtering Month from Date/Time

    Can anyone help me filter my Access database query based on the month in a Date/Time recordset?

    Here's what I've tried:

    Database Record "AgreeDate":
    Date/Time format. i.e. 1/9/2007


    1) Tried filtering the recordset:
    Dim ApplicationsRS
    Query = "SELECT ID, JobID, AgreeDate, Active, Hired FROM JobApplications"
    Set ApplicationsRS = Connect.Execute(Query)
    ApplicationsRS.Filter = MonthName(Month(ApplicationsRS("AgreeDate"))) = "January"

    Filter Results:
    ADODB.Recordset error '800a0bb9'
    Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
    default_month.asp, line 35


    2) Tried filtering in the initial query:
    Dim ApplicationsRS
    Query = "SELECT ID, JobID, AgreeDate, Active, Hired FROM JobApplications WHERE MonthName(Month(AgreeDate)) = January"
    Set ApplicationsRS = Connect.Execute(Query)


    Query Results:
    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
    [Microsoft][ODBC Microsoft Access Driver] Undefined function 'MonthName' in expression.
    default_month.asp, line 31


    Thank you for having a look.

  2. #2
    Join Date
    Feb 2003
    Posts
    2,745
    Code:
    SELECT ID, JobID, AgreeDate, Active, Hired FROM JobApplications WHERE Month(AgreeDate) = 1

  3. #3
    Join Date
    Oct 2006
    Posts
    3
    Quote Originally Posted by russell
    Code:
    SELECT ID, JobID, AgreeDate, Active, Hired FROM JobApplications WHERE Month(AgreeDate) = 1
    Worked perfectly. Thanks Russell.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles