Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 5th, 2003, 10:55 PM
svakula svakula is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Hyd, INDIA
Posts: 7 svakula User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
LIKE operator not working with MS Access SQL Queries

I 'm developing an app using MS Access and VB6.0. everything is going fine but when i run SQL Queries using like orerator, it is not working. The same query executed successfully in Visual Data manager.

one of the queries ..

Q: "select * from Authors where AuthorName like 'Ra*' and Year like '19*' .
The query opens no records eventhough i have records in the database which satisfies the criteria. The same query getting records when executing from Access. but not from VB.

It is very urgent. I failed to write Find queries with different combinations. Is there any other way to search data using like operator.


Reply With Quote
  #2  
Old January 6th, 2003, 06:37 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 13
Send a message via MSN to aspnewbie
You might want to have a look at this thread for some ideas.


http://www.devarticles.com//forum/s...=&threadid=1096

Reply With Quote
  #3  
Old September 10th, 2004, 06:26 AM
neha neha is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 neha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
you have to use the '%' operator

For the like statement the wildcard character is the '%' operator; Also remember that MS SQL only supports ADO transactions, as opposed to DAO, so do your code accordingly.
Thanks
have fun

Quote:
Originally Posted by svakula
I 'm developing an app using MS Access and VB6.0. everything is going fine but when i run SQL Queries using like orerator, it is not working. The same query executed successfully in Visual Data manager.

one of the queries ..

Q: "select * from Authors where AuthorName like 'Ra*' and Year like '19*' .
The query opens no records eventhough i have records in the database which satisfies the criteria. The same query getting records when executing from Access. but not from VB.

It is very urgent. I failed to write Find queries with different combinations. Is there any other way to search data using like operator.


Reply With Quote
  #4  
Old July 6th, 2005, 08:01 PM
djl djl is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 1 djl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 54 sec
Reputation Power: 0
similar problem

I'm having the same problem as Svakula originally described. Using the '%' wildcard operator instead of the '*' wildcard operator (which works in the query in Access) does not make the query return results when run from VB. Does anyone have any idea what else I could try?

I have a long and complex query string for a database search frontend, and the query works in Access if I copy it over and run it directly, but doesn't work when run from VB.

Thanks

Reply With Quote
  #5  
Old July 15th, 2005, 02:30 AM
rengsp rengsp is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 1 rengsp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 23 sec
Reputation Power: 0
Smile Try '%' in vb instead of '*'

Also I had the same problem as like u and tired to find a solution.

finally i tried with '%' instead of the '*' wildcard operator which works fine with vb coding, but does not
working with access as access only work with '*'

so u must replace '%' inside vb then working fine.

Reply With Quote
  #6  
Old January 4th, 2006, 04:35 AM
Left Gan Left Gan is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 1 Left Gan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 43 sec
Reputation Power: 0
% not working always in vb(?)

Hello there,
I'm trying to run a SQL-statement in Vb and while % is working when it comes after a string (like 'Smith%'), it doesn't work when it is before the string (like '%ith') - I get no results. The query in Access works fine (with * of course) in both cases.

Can anyone answer me if he had this problem himself?

Reply With Quote
  #7  
Old March 31st, 2006, 08:53 AM
Monk Monk is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 1 Monk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 11 sec
Reputation Power: 0
Be aware that for DAO you need to use the '*' operator when using the LIKE command. But with ADO you need to use '%'. Now I may have this mixed up. If someone here is more sure of the difference please correct my post here.

Thanks!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > LIKE operator not working with MS Access SQL Queries


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap