Sheryl-
Assuming the name is text, then you need to wrap the comparison string in
quotes, like this:
3 Me.Recordset.FindFirst "[Client_Last_Name]= '" & Name_Search & "'"
John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
<http://www.viescas.com/> http://www.viescas.com/
(Paris, France)
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of sherylj
Sent: Friday, June 22, 2012 5:36 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Search by last name on a form V2010
It seems like it should be straight forward to me, but I'm missing something,
because I keep getting an error when I run the code that says, "The MS Database
Engine does not recognize Smith (or any other last name I enter) as a valid
field name or expression".
I just have a simple form that I want users to sort by last name. I created a
command button in a header with the following placed in the on click code.
Can anybody tell me what I am doing wrong???
Private Sub Command99_Click()
2 If IsNull(Name_Search) = False Then
3 Me.Recordset.FindFirst "[Client_Last_Name]=" & Name_Search
4 Me!Name_Search = Null
5 If Me.Recordset.NoMatch Then
6 MsgBox "No record found", vbOKOnly + vbInformation, "Sorry"
7 Me!Name_Search = Null
8 End If
9 End If
10 End Sub
[Non-text portions of this message have been removed]
Jumat, 22 Juni 2012
RE: [MS_AccessPros] Search by last name on a form V2010
__._,_.___
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar