Hello Excel Forum,
Looking for help as usual. I am completing a file to look up employees info and to have the ability to add that info by clicking the option " Edit ". To complete that I am using a text box named "ID" that would find the ID value of the employee (which is a random number) and will give me the ability to edit the info.
This is the code I am using...
Somehow it seems that I have disabled the text box ID and it is not pulling up any results. I need help... Attached the file for reference
Private Sub cmdEdit_Click()
'error handler
On Error GoTo cmdEdit_Click_Error
'check that there is data to edit
If Me.txtID = "" Then
Call MsgBox("The fields are not complete", vbInformation, "Edit Contact")
Exit Sub
End If
'find the value in case of duplicates we use an ID
Set findvalue = Sheet1.Range("n8:n10000").Find(what:=Me.txtID, LookIn:=xlValues)
'findvalue.Value = Me.txtID "we do not want to edit the ID"
findvalue.Offset(0, -1).Value = Me.txtEmail.Value
findvalue.Offset(0, -2).Value = Me.txtAddress.Value
findvalue.Offset(0, -3).Value = Me.txtNeigborhood.Value
findvalue.Offset(0, -4).Value = Me.txtPhone.Value
findvalue.Offset(0, -5).Value = Me.txtSupervisor.Value
findvalue.Offset(0, -6).Value = Me.txtNTlogin.Value
findvalue.Offset(0, -7).Value = Me.txtOperatorID.Value
findvalue.Offset(0, -8).Value = Me.txtContractorID.Value
findvalue.Offset(0, -9).Value = Me.txtAvayaID.Value
findvalue.Offset(0, -10).Value = Me.txtEmployeeID.Value
findvalue.Offset(0, -11).Value = Me.txtFirstName.Value
findvalue.Offset(0, -12).Value = Me.txtLastName.Value
Call MsgBox("The contact has been updated", vbInformation, "Edit Contact")
'reset error
On Error GoTo 0
Exit Sub
'if error occurs then show me exactly where the error occurs
cmdEdit_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure cmdEdit_Click of Form PhoneList"
End Sub
Bookmarks