D
Daniel M
I have some code to edit a record set. I cannot seem to get it working. Can
someone take a look and tell me why? I have set the form text box (txtDID) to
the second record in the table (6). When i go throught the loop, the msgbox
displays 5=6. Fine that is wrong so it should reloop. the next loop i recieve
6=6 in the msgbox but it does not do the edit. it jumps out of the IF? Can
someone tell my why 6 is not = 6? Thanks.
Dim Rs As Recordset
Set Rs = CurrentDb.OpenRecordset("Departments")
Do While Not Rs.EOF
If Rs("departmentid") = txtDID.Value Then
Rs.Edit
Rs("DepartmentName") = txtCityState
Rs.Update
Rs.Close
End If
MsgBox Rs("departmentid") & " = " & txtDID.Value
Rs.MoveNext
Loop
someone take a look and tell me why? I have set the form text box (txtDID) to
the second record in the table (6). When i go throught the loop, the msgbox
displays 5=6. Fine that is wrong so it should reloop. the next loop i recieve
6=6 in the msgbox but it does not do the edit. it jumps out of the IF? Can
someone tell my why 6 is not = 6? Thanks.
Dim Rs As Recordset
Set Rs = CurrentDb.OpenRecordset("Departments")
Do While Not Rs.EOF
If Rs("departmentid") = txtDID.Value Then
Rs.Edit
Rs("DepartmentName") = txtCityState
Rs.Update
Rs.Close
End If
MsgBox Rs("departmentid") & " = " & txtDID.Value
Rs.MoveNext
Loop