Hi all,
I have a search button that do a vlookup based on what option button is choosen. for a couple of weeks I have been trying to write a error handle but with no success. I want to write a few different handles but it doesn't work. here is my code. First handler I want to create is if not found please update the outlook list If not found again maybe a typo if not found choose another option than loop. I hope i explained this correctly..
Private Sub cmdsearch_Click()
Dim a As String
Dim b As String
Dim c As String
Dim answer As String
Dim answer2 As String
'Continue:
'On Error GoTo trap
'On Error GoTo trap2
'If obtclient.Value = False And optalias.Value = False Then
' MsgBox "Select an option to search for client", vbOKCancel'
If obtclient.Value = True Then
a = Application.WorksheetFunction.VLookup(Worksheets("INPUT").Range("B1"), Worksheets("Outlook Info").Range("a1:C10000"), 2, False)
txtCname = txtsearch
txtAlais = a
txtphone = Application.WorksheetFunction.VLookup(Worksheets("INPUT").Range("B1"), Worksheets("Outlook Info").Range("a1:c10000"), 3, False)
ElseIf optalias.Value = True Then
b = Application.WorksheetFunction.VLookup(Worksheets("INPUT").Range("B1"), Worksheets("Outlook Info").Range("D1:F10000"), 3, False)
txtAlais.Value = txtsearch
txtCname = b
txtphone = Application.WorksheetFunction.VLookup(Worksheets("INPUT").Range("B1"), Worksheets("Outlook Info").Range("D1:F10000"), 2, False)
Else
optphone.Value = True
c = Application.WorksheetFunction.VLookup(Worksheets("INPUT").Range("B1"), Worksheets("Outlook Info").Range("g1:I10000"), 2, False)
txtphone = txtsearch
txtCname = c
txtAlais = Application.WorksheetFunction.VLookup(Worksheets("INPUT").Range("B1"), Worksheets("Outlook Info").Range("g1:I10000"), 3, False)
End If
lblstartup.Visible = False
lblstartup2.Visible = False
lbldate.Visible = True
txtdate.Visible = True
'Frame3.Visible = False
Frame2.Visible = True
Frame5.Visible = True
lblissue.Visible = True
txtissue.Visible = True
cmdsi.Visible = True
lbltitle.Visible = True
txttitle.Visible = True
lblsystem.Visible = True
txtsystem.Visible = True
lblcomponent.Visible = True
txtcomp.Visible = True
lblitem.Visible = True
txtitem.Visible = True
Label4.Visible = True
txtassign.Visible = True
lbldescription.Visible = True
txtdescription.Visible = True
Label5.Visible = True
txtsolution.Visible = True
' Resume Continue
'answer = MsgBox("yes", vbQuestion + vbOKCancel, "Error")
'If answer = vbOK Then Resume Continue
'trap2:
'answer2 = MsgBox("no", vbQuestion + vbOKCancel, "Error")
'If answer2 = vbOK Then Resume Continue
'MsgBox "Select an option to search for client", vbOKCancel
End Sub
Bookmarks