Deleting specific records and counting

BlueCarpet

New member
Local time
Today, 20:37
Joined
Sep 1, 2003
Messages
9
Hi, I originally posted this problem on the Tables forum but having read a little bit more about Access, I think that perhaps I am looking at some kind of Macro using the RecordSet functions.

"Suppose I have someone who writes an exam 10 times in one day. However, it is only the last result of that day I am interested in, not the preceding nine. When the information is entered into a spreadsheet, it will have the StudentID appearing 10 times, with the exam date with a result alongside each record. So I meant unique to the extent that each student is uniquely identified by their ID. However there could be 1000 students per day, each with differing amounts of times they have sat the exam. So, if I only want the first entry with that particular ID, can I ask Access to get rid of the next 9. Is there some way to "loop" through the data to search for each ID, then discard the rest or perhaps loop through and ask Access or Excel or whatever to take each time it first encounters a UniqueID to dump that record into another Table or spreadsheet"

Now, the problem is compounded by the fact that I also need to know the number of duplicates of each StudentID. So, an analogy is that I will need to count how many times each student has written that exam that day, as well as only ultimately being interested in the final result.

If if makes things easier, I can also structure the problem another way. What if I were to be interested in the average mark of the total number of times the student has taken the exam in that day rather than just the final result. That way, I think that it would be possible to keep all the relevant records in one table to be able to count the number of times the exam is taken, as well as then just doing an operation on it to get the average of one field per StudentID.

Any help would be greatly appreciated!
 
This sounds like it could be done by a relatively simple group by query...

Group by student number
first of every other field
avg of grade
count off (same but new field) student number

Regardszzzz
 
This looks promising. I have tried some simple statements in SQLview however I keep coming up with some errors. Am I going to have to do this by Macro? In which case, does anyone have any pointers as to how to structure the problem.
 
post a sample of your db and i will get the query working for ya...
 
I am posting the database. The table concerned is the only one in there. Basically, I need to group the records by GFICODE. Following that, I need the averages of the BID and OFFER fields for the grouped records. All other fields ought to be identical by GFICODE (there are a couple of exceptions but they can be ignored). However, I also need to know how many individual records were grouped under each GFICODE and be able to use that value for something else. Thanks in advance
 

Attachments

Attached find your DB again. 2 queries
qryFullGroupBy (creates duplicate GFI Codes, dont want that i think)
qryFirst (unique Codes, this is what you want i think)

Both with number of records and averages on Offer and Bid.

If i may comment on your DB tho:
- In future do not use ALL CAPS field names it becommes unreadable over time...
- do not use special characters (like *. , ; / \) and spaces in fieldnames. It will bother you time and time again, having to use [ ] and maybe running into trouble in the future....
- When using a field name ending on things like ID and Code Access automaticly creates indexes (bloating the DB) some might not be necessary, saving space, money and time. (Look at your BID field for instance)

RegardsZzzzz

The Mailman
 

Attachments

Hugely appreciated. Thanks for all the advice regarding Access, it will certainly be noted!
 

Users who are viewing this thread

Back
Top Bottom