Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping over access query

Status
Not open for further replies.

reg999

Technical User
Jan 17, 2005
37
US
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.

Any help with this is greatly appreciated. I appologize if this is a stupid or inappropriate question.
Reg999
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top