Can someone help me debug this. I have found the error leads to this line but how can i stop the error?
Run-time error '94': Invalid use of Null.
Option Compare Database
Option Explicit
Dim Msg As VbMsgBoxResult
Dim StartText As Long
Dim TextToFind As String
Dim TextToBeSearched As String
Private Sub Form_Current()
StartText = 0
TextToFind = txtFindWhat <----------------------------------- This is where the error is coming up
TextToBeSearched = NOTES & ""
cmdFindNext.Visible = (Trim(txtFindWhat) & "" <> "")
End Sub
Private Sub txtFindWhat_Change()
Beep
cmdFindNext.Visible = (Trim(txtFindWhat.Text) & "" <> "")
If Not cmdFindNext.Visible Then
Exit Sub
End If
StartText = 0
TextToFind = txtFindWhat.Text
TextToBeSearched = NOTES
End Sub
Private Sub cmdFindNext_Click()
StartText = InStr(StartText + 1, TextToBeSearched, TextToFind)
If StartText = 0 Then
Msg = MsgBox("The text """ & txtFindWhat & """ is (no more) finded", vbInformation)
StartText = 1
Exit Sub
End If
NOTES.SetFocus
NOTES.SelStart = StartText - 1
NOTES.SelLength = Len(TextToFind)
End Sub
Run-time error '94': Invalid use of Null.
Option Compare Database
Option Explicit
Dim Msg As VbMsgBoxResult
Dim StartText As Long
Dim TextToFind As String
Dim TextToBeSearched As String
Private Sub Form_Current()
StartText = 0
TextToFind = txtFindWhat <----------------------------------- This is where the error is coming up
TextToBeSearched = NOTES & ""
cmdFindNext.Visible = (Trim(txtFindWhat) & "" <> "")
End Sub
Private Sub txtFindWhat_Change()
Beep
cmdFindNext.Visible = (Trim(txtFindWhat.Text) & "" <> "")
If Not cmdFindNext.Visible Then
Exit Sub
End If
StartText = 0
TextToFind = txtFindWhat.Text
TextToBeSearched = NOTES
End Sub
Private Sub cmdFindNext_Click()
StartText = InStr(StartText + 1, TextToBeSearched, TextToFind)
If StartText = 0 Then
Msg = MsgBox("The text """ & txtFindWhat & """ is (no more) finded", vbInformation)
StartText = 1
Exit Sub
End If
NOTES.SetFocus
NOTES.SelStart = StartText - 1
NOTES.SelLength = Len(TextToFind)
End Sub