Hi, Im trying to, upon the click of a forms button, search the records in one table for all records matching a certain number. I then want to update another table with all these records...but am stuck in the coding. This is what i have so far...
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblAllInfo", dbOpenDynaset)
With rs
.MoveFirst
Do Until .EOF
If .Fields(1).Value Is 1 Then
event_num = .Fields(1).Value
Sport = .Fields(2).Value
team = .Fields(3).Value
Date = .Fields(4).Value
Time = .Fields(5).Value
rs.Update
Set rs = db.OpenRecordset("tblCurrentEvent", dbOpenDynaset)
rs.AddNew
rs![Event_No] = event_num
rs![Sport] = sport
rs![Team_Player] = team
rs![Date] = Date
rs![Time] = Time
DoCmd.OpenForm "frmInfo" 'whose record source is tblCurrentEvent
But I really need to be updating the latter table within the loop but dont know how to do that without resetting the loop pointer?? Or would it be better to create a form for tblAllInfo. Any help would be appreciated! Tania smile
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblAllInfo", dbOpenDynaset)
With rs
.MoveFirst
Do Until .EOF
If .Fields(1).Value Is 1 Then
event_num = .Fields(1).Value
Sport = .Fields(2).Value
team = .Fields(3).Value
Date = .Fields(4).Value
Time = .Fields(5).Value
rs.Update
Set rs = db.OpenRecordset("tblCurrentEvent", dbOpenDynaset)
rs.AddNew
rs![Event_No] = event_num
rs![Sport] = sport
rs![Team_Player] = team
rs![Date] = Date
rs![Time] = Time
DoCmd.OpenForm "frmInfo" 'whose record source is tblCurrentEvent
But I really need to be updating the latter table within the loop but dont know how to do that without resetting the loop pointer?? Or would it be better to create a form for tblAllInfo. Any help would be appreciated! Tania smile