I am having trouble editing records using a form. When I open the form, I get a complile error for rec.Edit. Here is the code:
Private Sub Command0_enter()
Dim dbs As Database
Dim rec As Recordset
Dim strTable As String
Dim intLength As Integer
Dim strNewID As String
strTable = "Active Employees List"
Set dbs = CurrentDb()
Set rec = dbs.OpenRecordset(strTable, dbOpenTable)
rec.MoveFirst
Do
rec.Edit
rec![Employee Number] = Right$("0000" & rec![Employee Number], 4)
rec.Update
rec.MoveNext
Loop While Not rec.EOF
rec.Close
End Sub
Some of the records in the table are transferred without the leading 0, so I am attempting to add that 0 back in so all of the numbers have 4 didgits. This code has worked before, but for some reason will not run now. Any ideas? Thanks.
Private Sub Command0_enter()
Dim dbs As Database
Dim rec As Recordset
Dim strTable As String
Dim intLength As Integer
Dim strNewID As String
strTable = "Active Employees List"
Set dbs = CurrentDb()
Set rec = dbs.OpenRecordset(strTable, dbOpenTable)
rec.MoveFirst
Do
rec.Edit
rec![Employee Number] = Right$("0000" & rec![Employee Number], 4)
rec.Update
rec.MoveNext
Loop While Not rec.EOF
rec.Close
End Sub
Some of the records in the table are transferred without the leading 0, so I am attempting to add that 0 back in so all of the numbers have 4 didgits. This code has worked before, but for some reason will not run now. Any ideas? Thanks.