B
bhammer
The subdatasheet's current record has a Doc_Number text field and a Comments
memo field. Some records have four digits of the Doc_Number in the Comments
field. I want to find the record with the matching four digits in the
Comments field.
I can get the four digits I want, but I can't get the FindNext method to
work using the string I have built, for example,
[Comments] = Like *0123*
------------------------
'Find the record on Main that matches the SubForm.
Dim rs as Recordset
Dim varBookmark as Variaint
Set rs = Forms.MyForm.Form.Recordset
varBookmark = rs.Bookmark
strSearch = "Like *" & Left(Right(Me.Doc_Number, 8), 4) & "*"
rs.FindNext "[Comments] = " & Chr(34) & strSearch & Chr(34)
If rs.NoMatch Then
rs.Bookmark = varBookmark
MsgBox "There is No matching Document.", , "ByAddressSub_Current"
Else:
.Form.Bookmark = rs.Bookmark
End If
memo field. Some records have four digits of the Doc_Number in the Comments
field. I want to find the record with the matching four digits in the
Comments field.
I can get the four digits I want, but I can't get the FindNext method to
work using the string I have built, for example,
[Comments] = Like *0123*
------------------------
'Find the record on Main that matches the SubForm.
Dim rs as Recordset
Dim varBookmark as Variaint
Set rs = Forms.MyForm.Form.Recordset
varBookmark = rs.Bookmark
strSearch = "Like *" & Left(Right(Me.Doc_Number, 8), 4) & "*"
rs.FindNext "[Comments] = " & Chr(34) & strSearch & Chr(34)
If rs.NoMatch Then
rs.Bookmark = varBookmark
MsgBox "There is No matching Document.", , "ByAddressSub_Current"
Else:
.Form.Bookmark = rs.Bookmark
End If