I think that this should be easy, but I'm having trouble. I'm creating a database for my shooting club. I need to select each shooter's top ten targets from a table. I have a top ten, append query that I'm trying to loop over with a FOR EACH loop. I have a field holding each shooter's ID number in another query. --> SrSt.ShtrID
Here is the query that I'm trying to loop over:
INSERT INTO TopTnG ( ShtrID, Gun, G )
SELECT TOP 10 Targets.ShtrID, Targets.Gun, Targets.G
FROM Targets
WHERE (((Targets.ShtrID)=[Forms]![NameList]![ShtrID]) AND ((Targets.Gun)="Light") AND ((Targets.G) Is Not Null));
The reference '[Forms]![NameList]![ShtrID]' is left over from doing the query from a button on a continuous form.
I haven't done any programming since 1989, so I know that it's obvious that I'm a rusty old critter.
Reg999
Here is the query that I'm trying to loop over:
INSERT INTO TopTnG ( ShtrID, Gun, G )
SELECT TOP 10 Targets.ShtrID, Targets.Gun, Targets.G
FROM Targets
WHERE (((Targets.ShtrID)=[Forms]![NameList]![ShtrID]) AND ((Targets.Gun)="Light") AND ((Targets.G) Is Not Null));
The reference '[Forms]![NameList]![ShtrID]' is left over from doing the query from a button on a continuous form.
I haven't done any programming since 1989, so I know that it's obvious that I'm a rusty old critter.
Reg999