+ Reply to Thread
Results 1 to 3 of 3

IF Statement to lookup specific values in a field and also a count with multiple criteria

  1. #1
    Registered User
    Join Date
    04-14-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    36

    IF Statement to lookup specific values in a field and also a count with multiple criteria

    Hi Access pro heads, This site has helped me immensely improve my Excel but now that I have been driven to develop an Access database, which i have never ever used, I am struggling with getting to grips with the querying and expressions despite the tutorial courses.

    I have uploaded an employee database that logs their tasks. The tasks are ranked in difficulty by Colour and Score.

    I have an employee details main form of all employee records which has a subform showing all the tasks for each employee record selected.

    I need help building an expression to auto populate 3 field boxes on the employee records form which are: Last Supervised, Task Colour and Total Score.

    Q1. Last Supervised: I need this to look up the [Supervised] field in Task Data for any active (viewed) employee, find the latest 'Yes' in that field and return and display the Supervised Date for that latest record.

    Q2. Task Colour: If field [Task Colour] in Task Data for any active (viewed) employee, contains 'Red' and [Status] is Doing then Display 'RED' in task colour, else if 'Yellow' and [Status] is Doing then Display 'Yellow' else Display 'Blue'.

    Q3. Total Score: Total the field [Score] in Task Data for any active (viewed) employee for all records that are Doing status and display this.

    I really hope you could help me with this a I think I'll have a good basis to progress from here...

    Thanks in advance...
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,177

    Re: IF Statement to lookup specific values in a field and also a count with multiple crite

    This too can be done with a sub-form.
    The sub form will have those 3 fields, LAST SUPERVISED, COLOUR, SCORE.

    Make a query , qsMaxTask1Person, that pulls the MAX taskID from Task table, and from that 1 persons ID

    SELECT Max([Task Data].[Task ID]) AS [MaxOfTask ID], [Task Data].Supervised, [Task Data].[Supervised Date], [Task Data].Score
    FROM [Task Data]
    GROUP BY [Task Data].[Employee ID], [Task Data].Supervised, [Task Data].[Supervised Date], [Task Data].Score
    HAVING ((([Task Data].[Employee ID])=[forms]![EmployeeRecords]![ID]) AND (([Task Data].Supervised)="yes"));


    Then attach this query as the form's datasource. Link them in the subform on ID.

  3. #3
    Registered User
    Join Date
    04-14-2015
    Location
    London
    MS-Off Ver
    2007
    Posts
    36

    Re: IF Statement to lookup specific values in a field and also a count with multiple crite

    Quote Originally Posted by ranman256 View Post
    This too can be done with a sub-form.
    The sub form will have those 3 fields, LAST SUPERVISED, COLOUR, SCORE.

    Make a query , qsMaxTask1Person, that pulls the MAX taskID from Task table, and from that 1 persons ID

    SELECT Max([Task Data].[Task ID]) AS [MaxOfTask ID], [Task Data].Supervised, [Task Data].[Supervised Date], [Task Data].Score
    FROM [Task Data]
    GROUP BY [Task Data].[Employee ID], [Task Data].Supervised, [Task Data].[Supervised Date], [Task Data].Score
    HAVING ((([Task Data].[Employee ID])=[forms]![EmployeeRecords]![ID]) AND (([Task Data].Supervised)="yes"));


    Then attach this query as the form's datasource. Link them in the subform on ID.
    Hi ranman256, Thanks you very much for taking the time to assist me, with the risk of coming across as ungrateful, I would really benefit from a working example of the database I posted simply because as good as your explanation my be to access users, I am really spanking new to it and despite quickly grasping it's structuring logic and terminology, I am still learning the querying, sql language and trying to get to grips with it and I learn better by taking a working example and together with your explanation analysing what's happening so I can replicate that in future... it's how I became better at excel... and hopefully access.

    So could I please kindly ask you to try post a working copy of the database I uploaded so I work through it.

    Thanking you in advance.

+ 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. Count statement wtih multiple criteria only showing results for one criteria
    By uhlabomber in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-17-2013, 02:47 PM
  2. [SOLVED] IF Statement with multiple lookup criteria
    By kenadams378 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-16-2013, 10:02 AM
  3. Count values which meet specific criteria
    By araujo3rd in forum Excel General
    Replies: 10
    Last Post: 12-08-2012, 04:45 AM
  4. [SOLVED] How do I use a lookup table to sum values for specific criteria?
    By NJLExcel1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-08-2012, 02:57 PM
  5. Multiple criteria lookup if statement!
    By Buttercup in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-16-2009, 02:39 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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1