Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenation

Status
Not open for further replies.

TTThio

Programmer
May 3, 2001
185
US
Hi guys,

does anybody know how to concatenate the following:

i = 1

SQL = "SELECT field FROM table WHERE field = '0" & i &"'"

It does result in string :
SELECT field FROM table WHERE field = '01'

but then in setting the recordset, I got error:
"invalid relational operator"

Help please......






 
"SELECT field FROM table WHERE field =" & """" & "0" & i & """"
 
Okay, I'm taking the data from the oracle, and here's the complete syntax:

vSQL = "SELECT Count(Account) AS TotalCount FROM TB_OPTY_V Where (Sales_Team = '" & iName(i) & "') AND
(mid(Sales_Stage,1,1)= '" & i & "')"

If I dismiss the second criteria, it works fine. So it must be the 2nd criteria is wrong.

Any idea?
 
Is the Sales_Stage field numeric or text? Terry M. Hoey
 
Well, I think the problem is the SQL language for Oracle is not the same as for Access. So, I just substitute the 'Mid' with 'SUBSTR' and it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top