Listing 33.9 -- 33LIST09.TXT --- Fragment procedury poszukiwania rekordu

If srchtxt.Text <> "" Then
    item_grid_data = srchtxt.Text
    If search_v1.Value Then
      paySet.FindFirst "payeename like '" & srchtxt.Text & "*'"
      ChkSet.FindFirst "payeekey=" & paySet("payeeid")
      If ChkSet.NoMatch Then GoTo notfound
      item_grid_line = ChkSet("itemkey")

    ElseIf search_v2.Value Then
      ChkSet.FindFirst "chknum = '" & srchtxt.Text & "'"
      If ChkSet.NoMatch Then GoTo notfound
      item_grid_line = ChkSet("itemkey")

    ElseIf search_v3.Value Then
      ChkSet.FindFirst "amtpayed = '" & srchtxt.Text & "'"
      If ChkSet.NoMatch Then GoTo notfound
      item_grid_line = ChkSet("itemkey")

    ElseIf search_v4.Value Then
      ChkSet.FindFirst "amtdeposit = '" & srchtxt.Text & "'"
      If ChkSet.NoMatch Then GoTo notfound
      item_grid_line = ChkSet("itemkey")

    End If
    
    For I = 1 To chkreg.grdChkReg.Rows - 1
      chkreg.grdChkReg.Row = I
      chkreg.grdChkReg.Col = 0
      If chkreg.grdChkReg.Text = item_grid_line Then
         Exit For
      End If
    Next I

    If chkreg.grdChkReg.Rows > 15 Then
      chkreg.grdChkReg.TopRow = I
    End If

    chkreg.grdChkReg.SelStartRow = I
    chkreg.grdChkReg.SelEndRow = I
    chkreg.grdChkReg.SelStartCol = 2
    chkreg.grdChkReg.SelEndCol = 6
    BtnNext.Enabled = True
    MsgBox "Data Found", vbExclamation, App.Title
  Else
    MsgBox "No text entered in Search Box", vbCritical, App.Title
  End If
  Exit Sub

notfound:
  MsgBox "Data not found in Database", vbExclamation, App.Title



