Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Like SQL Query doesn't work in form
Message
 
To
04/04/2003 07:47:46
General information
Forum:
Visual Basic
Category:
VBA
Miscellaneous
Thread ID:
00773933
Message ID:
00773945
Views:
14
Replace the * wildcard with %.


>Hi all,
>
>I've got a SQL query that I'm pulling from user's selections on a form. The string is built using:
>
>
>theString = "select parcels.id, parcels.county_id, parcels.parcel_id, " & _
>            "parcels.owner, parcels.address1, parcels.city " & _
>            "from parcels " & _
>            "where " & Me.FieldToSearch.Value & " like '*" & _
>            Trim(Me.string) & "*'"
>
>
>When I run the code the query evaluates to:
>
>
>select parcels.id, parcels.county_id, parcels.parcel_id, parcels.owner, parcels.address1, parcels.city from parcels where Owner like '*se*'
>
>
>I've tried this exact SQL statement in a query (the evaluated one) and it works and I get 2 records using my test data. But when I run the form -- and I've checked the value of the evaluated SQL statement and it's exactly this not to mention I cut and paste the evaluated statement in the query that gave me 2 records -- I get 0 records in the recordset.
>
>Why would a SQL statement work as a query but the exact same one not work in a form? Why would I get 0 records in the recordset in the form whereas I get 2 records using the exact same SQL statement in my query?
>
>Thanks for any help you can give.
>
>Denise
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform