Results 1 to 5 of 5
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528

    Lightbulb If the value of the field

    Hello all


    I designed a query which works well
    What I want is: -
    1. If the value of the field (Expr1) from 80 to 100 selects the value of the field (Computer)
    2. If the value of the field (Expr1) from 70 to 80 selects the value of the field (Maths)
    3. If the value of the field (Expr1) from 60 to 70 selects the value of the field (Statistics)
    4. If the value of the field (Expr1) from 50 to 60 selects the value of the field (Medical)

    Thanks in advance

    SELECT tbStudents.StuID, tbStudents.NoAccepCentral, tbStudents.StudentName, tbStudents.TotalScores, Table1.Computer, Table1.Maths, Table1.Statistics, Table1.Medical, [TotalScores]/7 AS Expr1
    FROM tbStudents INNER JOIN Table1 ON tbStudents.StuID = Table1.id;

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by azhar2006 View Post
    Hello all
    I designed a query which works well
    What I want is: -
    1. If the value of the field (Expr1) from 80 to 100 selects the value of the field (Computer)
    2. If the value of the field (Expr1) from 70 to 80 selects the value of the field (Maths)
    3. If the value of the field (Expr1) from 60 to 70 selects the value of the field (Statistics)
    4. If the value of the field (Expr1) from 50 to 60 selects the value of the field (Medical)

    Thanks in advance

    SELECT tbStudents.StuID, tbStudents.NoAccepCentral, tbStudents.StudentName, tbStudents.TotalScores, Table1.Computer, Table1.Maths, Table1.Statistics, Table1.Medical, [TotalScores]/7 AS Expr1
    FROM tbStudents INNER JOIN Table1 ON tbStudents.StuID = Table1.id;
    Computers are real dumb but very precise. 80 could qualify for 1 or 2 as do the others with overlapping values.

  3. #3
    A S MANN is offline Advanced System Analyst
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    India
    Posts
    161
    Try
    Field:IIF([Expr1] >= 80,[Computer], IIF([Expr1] >= 70,[Maths],IIF([Expr1] >= 60,[Statistics],
    IIF([Expr1] >= 50,[Medical]," " ))))

  4. #4
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much

  5. #5
    A S MANN is offline Advanced System Analyst
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    India
    Posts
    161
    Mark as resolved if Issue is solved.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-03-2012, 10:17 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