Hi Guys
I have developed this SQL statement using VBA and am trying to execute it and load the results into an ADO recordset:
SELECT tblCandidate.CandID, tblCandidate.[Last name], tblCandidate.[First Name], ConvertID.[CV details] FROM tblCandidate INNER JOIN (SELECT [tblCV].[CV details], CLng([CandID]) AS ID FROM tblCV) AS ConvertID ON tblCandidate.CandID = ConvertID.ID WHERE tblCandidate.CandID IN (SELECT [CandID] FROM tblCandAddress WHERE AddID=1 And (Town Like 'Lon*' OR County Like 'Lon*' OR [Post Code 1] Like 'Lon*'))
When I copy the statement directly into a Query and run it in Access it returns records. When I execute it from VBA it does not. I think it may be how i am executing the statement, i have tried this which is what i use in VB6 (with a slight modification) and usually works fine:
Set cn = CurrentProject.Connection
Set ADOrst = cn.Execute(strSQL)
But it does not return any records..
Any ideas?
Cheers Si
I have developed this SQL statement using VBA and am trying to execute it and load the results into an ADO recordset:
SELECT tblCandidate.CandID, tblCandidate.[Last name], tblCandidate.[First Name], ConvertID.[CV details] FROM tblCandidate INNER JOIN (SELECT [tblCV].[CV details], CLng([CandID]) AS ID FROM tblCV) AS ConvertID ON tblCandidate.CandID = ConvertID.ID WHERE tblCandidate.CandID IN (SELECT [CandID] FROM tblCandAddress WHERE AddID=1 And (Town Like 'Lon*' OR County Like 'Lon*' OR [Post Code 1] Like 'Lon*'))
When I copy the statement directly into a Query and run it in Access it returns records. When I execute it from VBA it does not. I think it may be how i am executing the statement, i have tried this which is what i use in VB6 (with a slight modification) and usually works fine:
Set cn = CurrentProject.Connection
Set ADOrst = cn.Execute(strSQL)
But it does not return any records..
Any ideas?
Cheers Si