R
RHT
Guest
This code is from the MS Access 2000 VBA Help File (Topic 'RecordsetClone' - Example).
Sub SupplierID_AfterUpdate()
Dim rst As Recordset
Dim strSearchName As String
Set rst = Me.RecordsetClone
strSearchName = Str(Me!SupplierID)
rst.Find "SupplierID = " & strSearchName
If rst.NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
End Sub
It runs fine in Access '97 - and possibly Access 2.0 - but doesn't compile when I try it in Access 2000. When the 'compile' hits 'If rst.NoMatch' it returns an error message. (I'm using almost exactly this code attached to a Combo-box to move to the specified record on a form - except my strSearchName is already a string so doesn't need the Str() function.)
Anyone know why it won't work?
Sub SupplierID_AfterUpdate()
Dim rst As Recordset
Dim strSearchName As String
Set rst = Me.RecordsetClone
strSearchName = Str(Me!SupplierID)
rst.Find "SupplierID = " & strSearchName
If rst.NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
End Sub
It runs fine in Access '97 - and possibly Access 2.0 - but doesn't compile when I try it in Access 2000. When the 'compile' hits 'If rst.NoMatch' it returns an error message. (I'm using almost exactly this code attached to a Combo-box to move to the specified record on a form - except my strSearchName is already a string so doesn't need the Str() function.)
Anyone know why it won't work?