+ Reply to Thread
Results 1 to 3 of 3

Number of days in month from a given date

  1. #1
    Forum Contributor
    Join Date
    03-06-2013
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2007, 2010
    Posts
    127

    Number of days in month from a given date

    Hi all,

    Would any of you know how to create a calculated field in an Access 2003 query to calculate the number of days in a month for a given date.

    Field name is "Date"

    I need a function or formula. I'm trying to avoid VBA for this. Thanks.
    BrownBoy

    If happy, mark "SOVLED" & add to "REP"

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: Number of days in month from a given date

    I would build another table with three fields

    tblMonth
    ------------
    mID (PK)
    MonthID (1-12 representing month)
    MonthDays (Actual number of days for the month)

    Create a new field that contains the expression: =Month([Date])

    Save the query. Create a new query using the existing query as the record source. Join that query to the tblMonth on the field created and MonthID. Add the field MonthDays to the new query.

    BTW: Date is a reserved name in Access and really should not be used as field name. It may cause issues down the road.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    03-06-2013
    Location
    Salt Lake City, Utah
    MS-Off Ver
    2007, 2010
    Posts
    127

    Re: Number of days in month from a given date

    Thanks alansidman.

    I actually found the solution before I saw your reply. I'll try your recommendation and if it works I'll add to the rep. Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 14
    Last Post: 04-06-2015, 09:19 PM
  2. Replies: 8
    Last Post: 12-04-2013, 04:14 AM
  3. Replies: 2
    Last Post: 11-09-2012, 12:01 PM
  4. Replies: 4
    Last Post: 03-01-2012, 04:27 PM
  5. Replies: 3
    Last Post: 02-05-2012, 01:32 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1