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.