Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO control and SQL statement "Like" not Working 1

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I am using VB6 and the ADO navigation control<br>I am passing a parameter to the recordsource<br>Like so<br>&quot;Select * From Grocerys Where Description Like &quot;b*&quot; Order By Description&quot;<br><br>But It does not return any records<br>If I pass no parameters it returns all of the records like it should.<br>If I use this It works too.<br>&quot;Select * From Grocerys Where Description = &quot;Bananas&quot; Order By Description&quot;<br>It returns one record which it should.<br>There are 15 items in the list that start with &quot;B&quot;<br>If I use this code in Access which is where I started this project it works just fine there too. And I'm looking at the same Table in VB6.<br><br>but Whats up with the 'Like' statement????<br><br>I have used this code since MSAccess Version 2. <br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Did you try using an uppercase &quot;B&quot; in your LIKE statement?&nbsp;&nbsp;Unfortunately, I do not have a table set up where I can try this to tell you that it definitely makes a difference. <p>Bill Dean<br><a href=mailto:vfpman@netscape.net>vfpman@netscape.net</a><br><a href= Consulting, Inc.</a><br>Experienced application developer in Facilities Management and Environmental Services.<br>
Visual FoxPro, FoxPro 2.6, Visual Basic, Access, Clipper, CB86, Quick Basic, Lotus Macro.
 
Yes of course. I tried 16 different things.<br>What took 3 hours in Access has been a 2 day unproductive Nightmare in VB6. VB5 I'd have it done too. Microsoft has added, changed, or I don't know what, but nothing works the same as it did in the last 3 versions of VB.<br>I use this routine all over the place but in VB6 it don't work anymore.<br><br>Can the Datagrid work with a recordset or does it have to use an ADO Data control<br>Like this<br>SQL = Select * From Somewhere Where Something Like '&quot; & Me.Textbox & &quot;';&quot;<br>DataFGrid1.(something) = SQL<br>If so what do I put in the (something)<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Try:<br>&quot;Select * From Grocerys Where Description Like 'b%' Order By Description&quot;<br><br>The &quot;*&quot; character will not work in any of the &quot;real&quot; DBMS systems as a you have used it.&nbsp;&nbsp;The &quot;%&quot; character is the proper wildcard.&nbsp;&nbsp;The double quotes around your b can sometimes be problematic as well.<br><br>Ed
 
Thanks ED I'll try it tonight...<br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
It works Great!!!!!!! :)<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top