Forum: comp
Page 27
Subject: For you MS Access Gurus


  Posted by: JTSERB - [36549922] Thu, Jun 10, 2004, 18:58

How would I go about creating a if then statement in a access database?

For example,

Say im keeping track of baseball scores. On the form I have the 2 teams names their respective scores then check boxes for the following:

Team 1 Shutout?
Team 2 Shutout?
Team 1 No hitter?
Team 2 No hitter?
Team 1 Perfect Game?
Team 2 Perfect Game?

Now when I run a report... How would I get it to say How many times the respective team has done one of those listed above?

Hope I explained it well enough.

Thanks


 
1Trip
      Donor
      ID: 13961611
      Fri, Jun 11, 2004, 13:01
For a table named "Teams" with 4 fields
- "Team Name" (text)
- "Shutout" (Yes/No)
- "NoHitter" (Yes/No)
- "PerfectGame" (Yes/No)

Here is the SQL View for the query.

SELECT Teams.[Team Name], Count(Teams.Shutout) AS CountOfShutout, Count(Teams.NoHitter) AS CountOfNoHitter, Count(Teams.PerfectGame) AS CountOfPerfectGame
FROM Teams
GROUP BY Teams.[Team Name]
HAVING (((Count(Teams.Shutout))=Yes) AND ((Count(Teams.NoHitter))=Yes) AND ((Count(Teams.PerfectGame))=Yes));