Results 1 to 8 of 8
  1. #1
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370

    Pulling Year from system

    Hello all,

    I'm trying to get a date #1/1/2014# to pull the year from Now()

    Here is my code:

    Code:
    DCount("Field1", "Table1", "[Field1] Between #1/1/2014# And #1/8/2014#")
    
    I would really like for something like this:
    
    DCount("Field1", "Table1", "[Field1] Between #1/1/Year(Now())# And #1/8/Year(Now()#")
    However the bottom code does not work. Can anyone steer me in the right direction?

    Thanks

  2. #2
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Can a mod move this post to General Access forum?

    I was looking through forms section and accidentally posted here.

    Thank you

  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    Thread moved. Check out the DateSerial() function.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Thanks for moving thread, and Ok I'll give it a look. I'll get back to you.

  5. #5
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Well, I'm not getting any errors, but it isn't returning the correct count either.. It's returning 0 when it should be returning 4.

  6. #6
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    What did you try exactly? I had in mind using DateSerial for each of the dates, probably concatenated into the string, though that may not be necessary.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Nevermind, my dates in my table are 2014, so I just needed to "-1"

    It's working now, thanks paul.

  8. #8
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,523
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 4
    Last Post: 06-04-2014, 11:24 PM
  2. Replies: 2
    Last Post: 04-25-2014, 11:33 PM
  3. Replies: 4
    Last Post: 01-09-2013, 11:16 AM
  4. Replies: 4
    Last Post: 01-10-2012, 06:26 PM
  5. Replies: 2
    Last Post: 04-12-2011, 10:14 AM

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