Access query with wildcard returns no results

" ... LIKE 'mystring%'" should work. Your example is missing the quotes, but I expect that's just a typo in the newsgroup post - if you were missing the quotes in the real SQL statement you should be getting an error message. Could you copy and paste the actual SQL string? Perhaps there may be something in the real SQL that may be relevant to the problem.
-- Brendan Reynolds (Access MVP)
wrote in message news:ed4c0432-c1b1-4d32-bdad-ef7f64205f84@discussions.microsoft.com...

[576 byte] By [MVPUser] at [2007-12-16]
# 1
When passing a sql statement

SELECT record FROM table WHERE record LIKE mystring*
to Access from VB.NET, the retuns a single row with (null) in it. The same query run in Access with the same string returns 8 rows, so I know they are there. I've found 3 or 4 articles describing this problem, but they either apply to older products (VB <5 or Access <2000) or they say to use the ANSI wildcard "%". I've tried that and still get no results. All the other queries work fine, no wildcards in the parameters, so I'm pretty sure it's not a connection issue.

Can anyone tell me what's going wrong here? I'm using VS.NET 2002 with Access 2003 on WinXP Pro SP2, and do have the latest update to Jet 4.0 installed. Is there a different way to pass the string with the wildcard? Can I use Access' "Left(...)" syntax as a string in the sql statement?

Thanks for any help!!!

TheBeard at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...
# 2
Thanks for the quick reply. That wasn't actually the problem, and there were no error messages. But you got me thinking on a different track, and it turned out to be a simple column/table name conflict. Thanks again!
TheBeard at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Framework Data Access and Storage...

.NET Development

Site Classified