Results 1 to 4 of 4
  1. #1
    tacoprincess is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    2

    Grouping by calculated Field in a Query

    Hello, apologies if this has been addressed before (I'm sure it has, but I can't seem to find a thread on it).


    I work with images from wildlife cameras, and our goal is to figure out which species visited which cameras per day.

    The metadata from my camera labels each ImageDate as a date and time (1/1/16 12:01 AM), but I only care about days, so I am using the expression Left([ImageDate],InStr(1,[ImageDate]," ")-1) which can create a new column with only the Date.

    My problem is, I want to write a query that gives me unique species per site per day, but I can't get the query to run. I'm wondering if it is because I can't used a calculated field in a query? I have tried to create a calculated field named "Date" in the table and then query from that and it won't work. I then tried to create a new field ("PhotoDate7" in the picture) and Group By that, but it also won't work.

    Any help would be greatly appreciated! I am a novice at Access and this has been a bit difficult.

    Click image for larger version. 

Name:	AccessHelp.JPG 
Views:	16 
Size:	105.6 KB 
ID:	27308

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    in the field
    format([imageDate],"mm/dd/yyyy")

    or
    right click [imagedate] query field, set the format there.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,941
    dates are numbers, not what you see as a formatted view

    if you want to group by the date (i.e. excluding the time element) use the datevalue function

    PhotDate7:datevalue(imagedate)


    note that date is a reserved word (it returns todays date)

    see this link about different date functions

    http://www.classanytime.com/mis333k/sjdatetime.html

  4. #4
    tacoprincess is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2017
    Posts
    2
    That worked! Thank you very much for your help!

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

Similar Threads

  1. Replies: 1
    Last Post: 02-03-2016, 06:54 PM
  2. Replies: 2
    Last Post: 12-30-2014, 01:32 PM
  3. Replies: 3
    Last Post: 02-13-2013, 10:15 AM
  4. Replies: 3
    Last Post: 07-31-2012, 06:05 AM
  5. Replies: 4
    Last Post: 01-04-2012, 02:35 PM

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