Syntax Error (input character)

Thread Solved

Join Date: Jan 2008
Posts: 57
Reputation: werks is an unknown quantity at this point 
Solved Threads: 1
werks's Avatar
werks werks is offline Offline
Junior Poster in Training

Syntax Error (input character)

 
0
  #1
Feb 23rd, 2008
Hello

Every time i input the character ' and % in the textfield it generate an error in my query.

The error:
Syntax error in query expression 'Title LIKE '%' %%';'.

My code:
  1. adoList.Open "SELECT * FROM qryOPAC WHERE Title LIKE '%" & varExp & "%';",CoNN,3,3



tnx in advance..
Kenneth
"Better Than Yesterday"
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 174
Reputation: TobbeK is an unknown quantity at this point 
Solved Threads: 3
TobbeK TobbeK is offline Offline
Junior Poster

Re: Syntax Error (input character)

 
0
  #2
Feb 24th, 2008
The wildcard characters can be different depending on what database in use.

Try using the * character and see if it works better. Also try to set a static value and and see if you get any results from the database as WHERE Title LIKE '%someword%'
or
WHERE Title LIKE '*someword*'
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 121
Reputation: Auzzie is an unknown quantity at this point 
Solved Threads: 16
Auzzie Auzzie is offline Offline
Junior Poster

Re: Syntax Error (input character)

 
0
  #3
Feb 25th, 2008
Also you missed the 2nd ' in your code
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Syntax Error (input character)

 
0
  #4
Feb 26th, 2008
The reason why it is coming up this way is that varexp is set to this:
  1. ' %

check what varexp's value is and make sure you have NO quotes in there whatsoever, as well as % signs.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 57
Reputation: werks is an unknown quantity at this point 
Solved Threads: 1
werks's Avatar
werks werks is offline Offline
Junior Poster in Training

Re: Syntax Error (input character)

 
0
  #5
Feb 27th, 2008
Thanks for your reply. I just found out how to manage that by using Replace() function.. btw thanks everybody
Kenneth
"Better Than Yesterday"
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC