Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bug with FindFirst? 1

Status
Not open for further replies.

Goondu

Technical User
Jan 14, 2004
92
SG
Access Version 2000.
Is there a problem with FindFirst with RecordSetClone? Does anyone knows a link?

Below is a sample code.

Code:
Private Sub Command0_Click()
Dim rs As DAO.Recordset
Set rs = Me.RecordSetClone
With rs
.FindFirst "CompanyID = " & """Chubb"""  'error Chubb-SP
If Not .EOF Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "no match"
End If
End With
Set rs = Nothing
End Sub

DataType for CompanyID is Text. The ID "Chubb" does not exist in the table but "Chubb-SP" is.

The problem with FindFirst if I search "Chubb" I can find the record for "Chubb-SP"

Using the Query Editor with the criteria "Chubb" was unable to find the record.

Using DAO OpenRecordset is the same as the Query Editor.

Both the Query Editor and DAO works as it is but not RecordSetClone.

Changing the FindFirst with no luck.
Code:
 .FindFirst "CompanyID = " & """" & "Chubb" & """"
 .FindFirst "CompanyID = " & "'" & "Chubb" & "'"

Is FindFirst a Number datatype search only for RecordSetClone?

You can create a simple DB to try out. Just to see if you have a similiar problem with mine.
 
How are ya Goondu . . .

Try:
Code:
[blue]   With rs
      .FindFirst "CompanyID = '" & "Chubb" & "'"  'error Chubb-SP
      
      If Not .[purple][b]NoMatch[/b][/purple] Then
         Me.Bookmark = rs.Bookmark
      Else
         MsgBox "no match"
      End If
   End With
[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hi TheAceMan1,

Thanks, I think I found out why. It because the record was on the first list in the form and initially I did use NoMatch. I mistook it for "FindFirst" for finding the record on the form. It was so strange that NoMatch did not work with the warning message box but now it's working. Need a break I guess.:)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top