Results 1 to 5 of 5
  1. #1
    Liam87 is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2012
    Posts
    10

    Count number of species per site

    I have two tables for a monitoring database. The SURVEY table has fields [Survey_ID(PK), Site_ID, Date_Survey] and RESULTS table has [Surver_ID(FK,PK), Species(PK), Abundance]. (survey_id and species are the PK as a single species should not be recorded more than once per survey as it should have been summed up at the end of the survey.).

    I have a query to give me the season and year, as the query I am working on I need to show how many sites a species occurs in, within each season of a particular year. (i.e. in winter 2012 magpies occured across 2 sites).

    In the query I have Season and Survey_Year (from the query mentioned above), with criteria set to the specific month and year respectively. I then have Species and now need to add an expression field to calculate how many sites this species comes across. I tried a few ways but kept getting aggregate errors coming from the Season and Survey_Year fields.



    Any pointers how to go about this would be great.

    Thanks, Liam

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    If possible, post the tables with a few dummy data thrown in along with the results that you want from your query.
    Also, post the sql code of the query that you currently have & the error message that is being thrown up.

    Thanks

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Yes, can be more productive if able to analyse data and test queries. If you want to provide db, follow instructions at bottom of my post.

    Consider building a report that uses Grouping & Sorting with aggregate calcs in group footers.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Liam87 is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2012
    Posts
    10
    Below is how the tables basically look. I'll have a play around with the report aggregation. Thanks

    SurveyID Species Abundance
    1 FrogA 10
    1 FrogB 2
    1 FrogD 1
    2 FrogA 2

    SurveyID SiteID Date_Survey
    1 2 14/11/2012
    2 4 15/11/2012

  5. #5
    Liam87 is offline Novice
    Windows Vista Access 2007
    Join Date
    Oct 2012
    Posts
    10
    I managed to solve it with a cross-tab query, concatenated the Season and Year so that the column would be the Spring2012, used species as the row and used Site, count as the value.

    Cheers

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

Similar Threads

  1. To count the number of lookup options
    By lizzywu in forum Queries
    Replies: 4
    Last Post: 02-23-2012, 07:47 PM
  2. Count number of days
    By ramindya in forum Queries
    Replies: 1
    Last Post: 02-22-2012, 04:47 PM
  3. Replies: 6
    Last Post: 07-25-2011, 01:54 PM
  4. count the number of records from a query
    By Nixx1401 in forum Queries
    Replies: 4
    Last Post: 05-24-2011, 06:45 PM
  5. Count Text as Number
    By AccessFreak in forum Forms
    Replies: 1
    Last Post: 01-04-2011, 12:49 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