This happens to me periodically and I just can't pin it down. I design a query
against some linked tables in access 2000, everything is good. I take the query
string directly from the sql view of the query designer, paste this into a table
field. From Visual Basic 6 I get this query string, execute it against the
connection and get an error "Unexpected Extra Token". It is complaining about the
INNER JOIN. It seems to be a provider issue, but, the query works fine from Access.
I have tried all the ADO versions 2.1-2.7 and get the same result. i verify the text
is not mangled, what have I missed? What does access do when generating the query
that I don't? My more basic queries do work fine so the connection is intact.

Thanks in advance...

for ex:

Private Sub Form_Load()

Dim mConn As ADODB.Connection
Dim mRec As New ADODB.Recordset
Dim cmd As ADODB.Command
Dim strSQL As String

Set mConn = New ADODB.Connection
mConn.Open "File Name=f:\alaflex.UDL"

strSQL = "SELECT HCANAG.MASTRO, HCANAG.CONTO, HCANAG.RAG_SOCIALE1, HCANAG.RAG_SOCIALE2, HVMOVT.INTESTA_C FROM HCANAG INNER JOIN HVMOVT ON HCANAG.CONTO = HVMOVT.INTESTA_C"


Set cmd = New ADODB.Command


cmd.ActiveConnection = mConn
cmd.CommandText = strSQL
cmd.CommandType = adCmdText
mRec.CursorLocation = adUseClient

Set mRec = cmd.Execute

Set mRec = Nothing


End Sub