If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Like Statement Dosent Work

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-18-04, 11:29
ONIL ONIL is offline
Registered User
 
Join Date: Feb 2004
Posts: 14
Like Statement Dosent Work

CQ.SQL = "PARAMETERS something1 LONG; " & _
" SELECT * FROM TELEPHONE_DIRECTORY" & _
" WHERE EXTENSION_NO LIKE '[something1]%' " & _
" ORDER BY LAST_NAME, EXTENSION_No ; "
Public Sub Text1_change()
CQ![something1] = Text1.Text
.......
.......(more coding)

end sub
everything works if i change the sql statement WHERE EXTENSION_NO = [something1]
Reply With Quote
  #2 (permalink)  
Old 02-18-04, 13:41
joebednarz joebednarz is offline
Registered User
 
Join Date: Dec 2003
Location: Oklahoma, USA
Posts: 354
Are you using SQL Server?

If you were using Oracle, the query would be:

Code:
...
' WHERE EXTENSION_NO LIKE "'|| something1 || '"%' ...
NOTE: ... EXTENSION_NO LIKE (single tick)(double tick) || something1 || (single tick)(double tick)%(single tick) ... in the variation of SQL you are using, you'll switch single and double tick use.

I wonder if the name of the variable is being put into your query instead of the value...

JoeB
Reply With Quote
  #3 (permalink)  
Old 02-19-04, 22:55
ONIL ONIL is offline
Registered User
 
Join Date: Feb 2004
Posts: 14
NO JOY STILL
Reply With Quote
  #4 (permalink)  
Old 02-19-04, 23:23
r123456 r123456 is offline
Registered User
 
Join Date: Sep 2003
Location: The extremely Royal borough of Kensington, London
Posts: 778
Access 2002,

Select *
from table
where column LIKE [param] &'*'
__________________
Bessie Braddock: Winston, you are drunk!
Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.
Reply With Quote
  #5 (permalink)  
Old 02-25-04, 04:40
ONIL ONIL is offline
Registered User
 
Join Date: Feb 2004
Posts: 14
issue solved

CQ.SQL = "PARAMETERS something1 string; " & _
" SELECT * FROM TELEPHONE_DIRECTORY" & _
" WHERE EXTENSION_NO LIKE [something1] " & _
" ORDER BY LAST_NAME, EXTENSION_No ; "

Public Sub Text1_change()
CQ![something1] = "*" & Text1.Text & "*"
.......
.......(more coding)

1. by changing the statement CQ![something1] = Text1.Text TO CQ![something1] = "*" & Text1.Text & "*" everything works
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On