hi
thanks for helping. when the for N= 1 to N= 255 is removed and in the syntax N is replaced with a numerical the select statement works prefectly
other details are as follows: -
For N = 1 To N = 255 Step 1
CQ.SQL = "PARAMETERS something1 STRING; SELECT * FROM TELEPHONE_DIRECTORY" & _
" WHERE LEFT(LAST_NAME," & N & ")LIKE [something1] " & _
" ORDER BY LAST_NAME; "
Next N
' THE FOLLOWING ALSO DOES NOT WORK !?!?!?!?!?
' IT POPULATES THE LIST BOX WITH ALL RECORDS
' CQ.SQL = "PARAMETERS something1 STRING; SELECT * FROM TELEPHONE_DIRECTORY" & _
' " WHERE LAST_NAME LIKE '[something1]' " & _
' " ORDER BY EXTENSION_No; "
Quote:
Originally posted by stadian
I ran that query in a sample database and it worked fine as it is, however I'm not too sure about your N index as you did not explain much what you are trying to do.
But basically, make sure that the table TELEPHONE_DIRECTORY does exist or that the spelling is correct and that it can be "seen" through your connection.
Other than that, we need to know more details if you can spare them.
Ref: select * from <table> where left(<field>,index) like (<condition>) order by <field>
is ok in itself.
I hope others can help you more.
|