DAO: query of multiple tables can not find

T

Tim

I try to use DAO to pull out two values from a query (qryTeacher). This query
is created by combining four tables that have inner join relationships. In
VBA, I wrote the codes as following (with all variables are already declared
properly.)

strSQLTeacher = "SELECT StudID, email FROM qryTeacher WHERE
((qryTeacher.StudID)='" & varStudID & "');"
Set rstTeacher = Student_DB.OpenRecordset(strSQLTeacher)

I got the error message saying that "database engine cannot find the input
table or query, "qryTeacher". BTW, I use Windows Vista and Access 2007. I
guess I have to write the full SQL statement that forms the query, not just
the query name, qryTeacher, for strSQLTeacher. Please help! Thank you.
 
T

Tim

Hi Alex, Yes, I am sure. It's declared already somewhere. So can you point
out for me what is the problem now? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top