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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Performing Access Queries in Excel

Status
Not open for further replies.

vbc22

Technical User
Dec 4, 2004
70
CA
Hi,

I've been creating Excel Add-Ins that act as mini-programs that fetch data from an Access database, which in turn has its tables linked to an Oracle backend.

It's only recently that I started encountering a couple of problems. There are no error messages; it simply runs forever without returning data.

The connection string is valid as I use it for other SQL's and it works fine.

Here is a sample of my code. It includes a subquery. I do not believe the subquery is causing the problem because I have another subroutine that runs a query with a subquery within it and it works fine.

Here is the SQL statement that seems to give Excel/Access a hard time:

Code:
SELECT jobID 
FROM tJobs LEFT JOIN tJobInfo 
     ON tJobs.jobID = tJobInfo.jobID 
WHERE tJobs.jobID Not In 
    (
     SELECT tJobs.jobID 
     FROM tJobSettings INNER JOIN tJobs
     ON tJobSettings.jobID = tJobs.jobID
     WHERE tJobs.client=99 AND 
           tJobs.period=200512 AND 
           tJobSettings.type=22
     )
     AND tJobs.client=99 AND
     tJobs.period=200512 AND
     tJobsInfo.status IS NULL

I don't know why it's not working. I ported this query to my personal PC at home using Excel & Access 2003 and it runs fine. The versions at work are based on Office 2000.

Perhaps its not the SQL statement; something to do with other parameters in the connection string perhaps?

I'm not too sure about that aspect of my code.

Any one experienced this kind of problem with Excel requesting queries via VBA and ADO code to Access?

I would really appreciate your comments. Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top