I have a program that is supposed to take the new name entered into "tblNames" and copy the "RecNum" of the "tblNames" to the "RecID" number of the "qryStationsUnused_636" Recordset.
It does copy the "RecNum" to the "RecID" but to the wrong Name in the "tblNames" For some reason it is not moving to the last record of my table but instead it lands on the 3rd to last record. Below is the program that I am using.
'Set Recordset
Set RSEmp = CurrentDb.OpenRecordset("tblNames")
Set RS636 = CurrentDb.OpenRecordset("qryStationsUnused_636")
'Match tblStations.RecID to tblName.ID
RS636.MoveFirst
RSEmp.MoveLast
MsgBox "RSEmp Name = " & RSEmp("NameF")
Do While RS636.EOF = False
If RS636("Use") = -1 Then
RS636.Edit
RS636("RecID") = RSEmp("RecNum")
RS636("Use") = 0
RS636.Update
RS636.Requery
Exit Do
End If
RS636.MoveNext
Loop
Thank you for your time and help on this matter
Robert M
It does copy the "RecNum" to the "RecID" but to the wrong Name in the "tblNames" For some reason it is not moving to the last record of my table but instead it lands on the 3rd to last record. Below is the program that I am using.
'Set Recordset
Set RSEmp = CurrentDb.OpenRecordset("tblNames")
Set RS636 = CurrentDb.OpenRecordset("qryStationsUnused_636")
'Match tblStations.RecID to tblName.ID
RS636.MoveFirst
RSEmp.MoveLast
MsgBox "RSEmp Name = " & RSEmp("NameF")
Do While RS636.EOF = False
If RS636("Use") = -1 Then
RS636.Edit
RS636("RecID") = RSEmp("RecNum")
RS636("Use") = 0
RS636.Update
RS636.Requery
Exit Do
End If
RS636.MoveNext
Loop
Thank you for your time and help on this matter
Robert M