Abdul-
Uh, you misspelled "FROM"!
strsql = "SELECT ID, EmpName FROM tblName WHERE EmpName Like '*" & Me.Text2 & "*'"
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/
(Paris, France)
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Abdul Shakeel
Sent: Thursday, December 01, 2011 12:52 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Filter List Box through Text Box
Dear john,
I tried following but nothing happend
Private Sub Text2_AfterUpdate()
Dim strsql As String
Dim strWhere As String
strsql = "SELECT ID, EmpName FORM tblName WHERE EmpName Like '*" & Me.Text2 & "*'"
Me.List0.RowSource = strsql
End Sub
by the way I was using the change event to update listbox as I type. how could I code then
Thanks & Regards,
--
Abdul Shakeel
________________________________
From: John Viescas <john@viescas.com>
To: MS_Access_Professionals@yahoogroups.com
Sent: Thursday, December 1, 2011 4:27 PM
Subject: RE: [MS_AccessPros] Filter List Box through Text Box
Abdul-
Why are you using the Change event and the Text property? The Text property of
a text box exists only when the control has the focus. Try using the control's
After Update event and just refer to Me.Text2.
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/
(Paris, France)
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Abdul Shakeel
Sent: Thursday, December 01, 2011 10:46 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Filter List Box through Text Box
I am trying to filter list box through my text box as I data change in text box
the code is as following but its not working what am I doing wrong
Private Sub Text2_Change()
Dim strsql As String
strsql = "SELECT ID, EmpName FORM tblName WHERE EmpName Like '*" &
Me.Text2.Text & "*'"
Me.List0.RowSource = strsql
End Sub
Thanks & Regards,
--
Abdul Shakeel
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
Kamis, 01 Desember 2011
RE: [MS_AccessPros] Filter List Box through Text Box
__._,_.___
MARKETPLACE
.
__,_._,___
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar