Small Code Not Working . .

Evagrius

Registered User.
Local time
Today, 01:21
Joined
Jul 10, 2010
Messages
170
Hi, I am not sure where I went wrong here, but I keep getting NoMatch when there is a match. The record source for this form is a query. Thank you for any help!

Code:
Private Sub txtFind_AfterUpdate()
   Dim rs As Recordset
   Set rs = Me.RecordsetClone
   rs.FindFirst "[Number]=" & "' & Me.txtFind & '"
   If rs.NoMatch Then
      MsgBox "Client Not Found"
   Else
      Me.Bookmark = rs.Bookmark
   End If
End Sub
 
I suspect that the field [Number] is a number data type in which case you don't need the single quotes.

NB: Number is a bad name for a field because it's a reserved keyword.
 
Hi vbaInet - I thought that too but I checked the table behind the query and that field is "TEXT". Also, I will change the name of that field - good catch. Do you have any other idea of why it will not work?? Thanks!
 
Here:

Code:
rs.FindFirst "[Number] = '" & Me.txtFind & "'"

Me.txtFind was being read as text and not a control.
 
vbaInet - I consider myself in your debt sir!! Thank you!!
 
You'll be on the top of my list when I get rich!! :) :)
 
With your intelectual horse power I am almost certain of it!! Once I find a way to break the speed of light though, I could catch up!!
 

Users who are viewing this thread

Back
Top Bottom