Results 1 to 5 of 5

Thread: Access - Expression for Request

  1. #1
    Join Date
    May 2008
    Posts
    2,442

    Access - Expression for Request

    In an Access query, I select the dates below premier days of current month (eg. <01/04/2009). This is a request to be made every month.
    What words to use, other than eg. <#01/04/09#, to be established once and for all.

  2. #2
    Join Date
    May 2008
    Posts
    685

    Re: Access - Expression for Request

    How about

    <cdate("01/" & Month(date()) & "/" & year(date()))

  3. #3
    Join Date
    May 2008
    Posts
    2,442

    Re: Access - Expression for Request

    Having had a very basic training for ACCESS, I will still call on your knowledge to me translate a phrase. I have to select the records where the dates are more than the last day of the month (eg >28/02/2009) or null. How to express this request unless:

    Is Null Or> #28/02/2009 #
    so that it is fixed once and for all.

    Can you explain what is meant by the expression that you gave me earlier: "01/" and "/"

  4. #4
    Join Date
    May 2008
    Posts
    685

    Re: Access - Expression for Request

    For the last day of the month is a bit more complicated. The easiest way to remove 1 being the first day of the month (the next being, no matter), history of getting the 31, 30, 29 or 28 depending on the month.

    In fact what I do is that I built date. The "&" is a concatenation of values. The CDate() converts a variable to date variable (required to filter on values of type date)

    So:
    - Date() = today's date.
    - Month(Date()) = month of the date. Returns 3
    - Year(Date()) = The years of the date. 2009 Returns

    If you concatenate all this with "&":
    - "01/" & Month(Date()) & "/" & year(date()) = 01/3/2009

    But it remains in the form of string. To convert it into a date, you put a CDate() to:

    - CDate ( "01/" & Month(Date()) & "/" & year(date())) = dated 01/03/2009.

  5. #5
    Join Date
    May 2008
    Posts
    2,442

    Re: Access - Expression for Request

    I wrote this:

    Is Null Or > CDate ( "01/" & Month(Date()) & "/" & Year(Date())) - 1
    apparently it works.

Similar Threads

  1. Replies: 4
    Last Post: 11-01-2014, 10:14 AM
  2. Replies: 1
    Last Post: 28-02-2012, 06:59 PM
  3. Replies: 8
    Last Post: 15-11-2011, 10:45 AM
  4. Replies: 3
    Last Post: 09-03-2011, 05:42 AM
  5. Replies: 3
    Last Post: 10-05-2007, 11:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,717,387,142.67131 seconds with 16 queries