P
pvp
I use a button to do a FindRecord and another for
FindNext.
FindRecord finds the first instance of a record with the
search string - no problem. FindNext never moves beyond
this record. This is true for fields where the searc
string occures repeatedly or not. My code is for
FindRecord is
"
Dim varFW As Variant, i As Long
On Error GoTo Err_Command3_Click
' check something to look for
If IsNull(Me.Text81) Then
...notification code...
GoTo Exit_Command3_Click
End If
'ok so there was, use it
Me.date_on_form.SetFocus 'asociate with underlying
table
varFW = Me.Text81 ' has search string
Me.Text81 = Null
DoCmd.FindRecord varFW, acAnywhere, False,
acSearchAll, False, acAll, True
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
"
the FindNext code looks like:
"
Dim i As Long
Dim bm As String
On Error GoTo Err_Command85_Click
bm = Me.Bookmark 'original record before find next
Me.Text81.SetFocus
DoCmd.FindNext
'still same record?
If StrComp(Me.Bookmark, bm, vbBinaryCompare) = 0 Then
GoTo Err_Command85_Click ' yes - fail
End If
Exit_Command85_Click:
Exit Sub
Err_Command85_Click:
Resume Exit_Command85_Click
"
FindNext.
FindRecord finds the first instance of a record with the
search string - no problem. FindNext never moves beyond
this record. This is true for fields where the searc
string occures repeatedly or not. My code is for
FindRecord is
"
Dim varFW As Variant, i As Long
On Error GoTo Err_Command3_Click
' check something to look for
If IsNull(Me.Text81) Then
...notification code...
GoTo Exit_Command3_Click
End If
'ok so there was, use it
Me.date_on_form.SetFocus 'asociate with underlying
table
varFW = Me.Text81 ' has search string
Me.Text81 = Null
DoCmd.FindRecord varFW, acAnywhere, False,
acSearchAll, False, acAll, True
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
"
the FindNext code looks like:
"
Dim i As Long
Dim bm As String
On Error GoTo Err_Command85_Click
bm = Me.Bookmark 'original record before find next
Me.Text81.SetFocus
DoCmd.FindNext
'still same record?
If StrComp(Me.Bookmark, bm, vbBinaryCompare) = 0 Then
GoTo Err_Command85_Click ' yes - fail
End If
Exit_Command85_Click:
Exit Sub
Err_Command85_Click:
Resume Exit_Command85_Click
"