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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot perform funtion while tables linked

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
I have a query that won't run while table links are in force. I had this problem with a select query until making it append. Can I modify the code below to enable it to be run while links are in force? Many thanks.

Set rsAllAthletes = CurrentDb.OpenRecordset("AllAthletes", dbOpenDynaset)
Set rsJUNCTION = CurrentDb.OpenRecordset("JUNCTION", dbOpenDynaset)
Set rsQRYTOP = CurrentDb.OpenRecordset("QRYTOP", dbOpenDynaset)

Do While Not rsAllAthletes.EOF
rsJUNCTION.AddNew
rsJUNCTION.Fields("ID2") = rsAllAthletes.Fields("ID2")
rsQRYTOP.FindFirst ("Athlete = '" & Replace(rsAllAthletes.Fields("Athlete"), "'", "''") & "'")
rsJUNCTION.Fields("AthleteID") = rsQRYTOP.Fields("AthleteID")
rsAllAthletes.MoveNext
rsJUNCTION.Update
Loop
 
Sorry, fixed. I had my queries in the wrong order, having no second table for the junction table to be created. Regards
 
Why not a simple append query like this ?
Code:
INSERT INTO JUNCTION (ID2,AthleteID)
SELECT A.ID2,T.AthleteID
FROM AllAthletes AS A INNER JOIN QRYTOP AS T ON A.Athlete=T.Athlete

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top