Hello, i don't know where the code is wrong or placed this code in wrong event. I just want in the "Update Existing" tab, when i input a data in "Quote Number" field and press enter the code will trigger, and when i erase the data that I input in "Quote Number" field, all the data in the fields will be erase also.
Private Sub TextBox14_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Application.ScreenUpdating = 0
Sheet1.Visible = True
Sheet1.Activate
Dim strFind, FirstAddress As String 'what to find
Dim rSearch As Range 'range to search
'Set rSearch = Sheet1.Range("a6", Range("a65536").End(xlUp))
Set rSearch = Sheet1.Range("A1", Sheet1.Range("A" & Rows.Count).End(xlUp))
strFind = Me.TextBox14.Value 'what to look for
Dim f As Integer
With rSearch
Set c = .Find(strFind, LookIn:=xlValues)
If Not c Is Nothing Then 'found it
c.Select
With Me 'load entry to form
.ComboBox10.Value = c.Offset(0, 1).Value
.TextBox12.Value = c.Offset(0, 3).Value
.TextBox13.Value = c.Offset(0, 4).Value
.TextBox15.Value = c.Offset(0, 11).Value
.ComboBox11.Value = c.Offset(0, 2).Value
.ComboBox12.Value = c.Offset(0, 12).Value
.ComboBox13.Value = c.Offset(0, 8).Value
.TextBox16.Value = c.Offset(0, 14).Value
.ComboBox14.Value = c.Offset(0, 13).Value
.TextBox17.Value = c.Offset(0, 15).Value
.ComboBox15.Value = c.Offset(0, 16).Value
.TextBox18.Value = c.Offset(0, 17).Value
.TextBox19.Value = c.Offset(0, 18).Value
.TextBox20.Value = c.Offset(0, 5).Value
.TextBox21.Value = c.Offset(0, 6).Value
.TextBox22.Value = c.Offset(0, 10).Value
.ComboBox9.Value = c.Offset(0, 7).Value
.TextBox12.Enabled = True
.CommandButton2.Enabled = True 'allow amendment
.TextBox13.Enabled = True
.TextBox14.Enabled = True
.TextBox15.Enabled = True
.TextBox16.Enabled = True
.TextBox17.Enabled = True
.TextBox18.Enabled = True
.TextBox19.Enabled = True
.TextBox20.Enabled = True
.TextBox21.Enabled = True
.TextBox22.Enabled = True
.ComboBox10.Enabled = True
.ComboBox11.Enabled = True
.ComboBox12.Enabled = True
.ComboBox13.Enabled = True
.ComboBox14.Enabled = True
.ComboBox15.Enabled = True
.ComboBox16.Enabled = True
.ComboBox9.Enabled = True
End With
End If
End With
End Sub
Bookmarks