Hello. I am trying to reduce the number of queries in a database.It is based on a table (Sheet1) which has 4 fields;
1) Received Date,
2) Serial Number-primary key- (3 types of item by serial no, prefixed by 'H', 'N' and 'G' (e.g. H123/12, N345/12 and G123/12).
3) Checkers (A,B,C,and D)
4) Date Checked
By using a query with the following SQL;
'G'Query;
Code:
SELECT Count(Sheet1.[Serial No]) AS [CountOfSerial No], Sheet1.[Date Checked], Count(IIf([Serial No] Like "G*" And [Checker]="A",[Serial No])) AS [A G Total], Count(IIf([Serial No] Like "G*" And [Checker]="B",[Serial No])) AS [B G Total], Count(IIf([Serial No] Like "G*" And [Checker]="C",[Serial No])) AS [C G Total], Count(IIf([Serial No] Like "G*" And [Checker]="D",[Serial No])) AS [D G Total]
FROM Sheet1
WHERE (((Sheet1.[Serial No]) Like "G*"))
GROUP BY Sheet1.[Date Checked];
I can populate textboxes on a form to show how much 'G' each checker did on a given day. Two Similar Queries give me the amount of 'H' and the amount of 'N'.
What I am now trying to formulate is a cumulative query that will tell me the amount they have done from a given date, till today. The date is entered on another form. I can do it using an individual query for each checker and each serial type,
Code:
SELECT Count(Sheet1.[Serial No]) AS [CountOfSerial No]
FROM Sheet1
WHERE (((Sheet1.[Date Checked]) Between [Forms]![CumulatorForm]![Text17] And [Forms]![CumulatorForm]![Text19]) AND ((Sheet1.[Serial]) Like "G*") AND ((Sheet1.[Checker])=”A”;
If I can wrap it into just three queries as above, so much the better Does anyone have any ideas? I have been trying to adapt the G Query for days now, but to no avail. Many thanks for looking, Mattbro