Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Like SQL Query doesn't work in form
Message
De
04/04/2003 11:58:56
 
Information générale
Forum:
Visual Basic
Catégorie:
VBA
Divers
Thread ID:
00773933
Message ID:
00774077
Vues:
16
That did the trick... okay, so a little SQL lesson needed here, please. What's the difference between * and %? I thought % replaced specific character (i.e., %%se is like Rose) but apparently not. What would that character be and why would * work in the query but not in the code?

Thanks for the help.

>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
~~~~~~~~~~
Denise
~~~~~~~~~~
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform