Run Time error 3464 fix?

Chrisopia

Registered User.
Local time
Today, 04:52
Joined
Jul 18, 2008
Messages
279
Code:
Private Sub QuickSearch_AfterUpdate()
    
DoCmd.Requery
Me.RecordsetClone.FindFirst "[CompanyName] = '" & Me![QuickSearch] & "'"
If Not Me.RecordsetClone.NoMatch Then
   Me.Bookmark = Me.RecordsetClone.Bookmark
Else
  MsgBox "Could not locate [" & Me![QuickSearch] & "]"
End If
End Sub

I kept receiving an error when running this code, runtime 3464, the one about data mismatch or something.

I fixed it but not sure why it fixed. The thing it highlighted was code:
Code:
Me.RecordsetClone.FindFirst "[CompanyName] = '" & Me![QuickSearch] & "'"

After playing around I discovered that my query (which comtained CompanyName) was sorted by customerID - and hense using the search tool (which is what this code is for) it says it couldn't find [109] for example (the customer ID of the record I selected).

So after sorting this out I then realised it was still selecting CustomerID because it was in the first column of the query, I didn't quite know the code to select which column so I just moved it along.

Now everything is working fine, but I'm not sure why. Oh well.
 
Chrisopia,

Me.RecordsetClone.FindFirst "[CompanyName] = '" & Me.QuickSearch.Column(1) & "'"

The .Column property starts counting at 0. The 2nd column is .Column(1)

Wayne
 

Users who are viewing this thread

Back
Top Bottom