My userform is performing backwards if the option button for whole is set to true it searches for partial, if its set for part it searchs whole. Steping through the case select does not seem to be recognizing true and false correctly.
I did verify that i didnt name them backwards. optWhole is set to true by default. I am not sure what is missing
I did verify that i didnt name them backwards. optWhole is set to true by default. I am not sure what is missing
Code:
Option Explicit
Dim SrchCrit As String
Dim SrchFld As String
Dim SrchRow As Integer
Dim SrchOpt As Boolean
Dim SrchType As String
Private Sub btnNextRec_Click()
Selection.FindNext(After:=ActiveCell).Activate
Call RetrieveRec
End Sub
Private Sub btnPrevRec_Click()
Selection.FindPrevious(After:=ActiveCell).Activate
Call RetrieveRec
End Sub
Private Sub btnSearch_Click()
SrchCrit = txtCriteria.Value
SrchRow = Application.VLookup(cmbField, Range("tbl_FldLU"), 2, False)
Select Case SrchOpt
Case optWhole = True
SrchType = xlWhole
Case optPartial = True
SrchType = xlPart
End Select
Range("A2").Offset(0, SrchRow).Resize(400, 1).Select
Selection.Find(What:=SrchCrit, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=SrchType, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Call RetrieveRec
End Sub