N
Naturalkiller3000
I use MS Access 2000 as front end, database is MS SQL 2000
as back end .
I have 2 tables : [Student] and [Teacher] . I want to
query whole student of a teacher (for example : "Peter") .
I make a query that:
Student(Code,Name,Description,TeacherCode)
Teacher(Code,Name,Description)
"Select * from dbo.Teacher INNER JOIN dbo.Student ON
dbo.Teacher.Code=dbo.Student.TeacherCode"
when I use [WhereCondition] in Docmd.OpenReport. I write
Docmd.OpenReport "rptClass", acViewPreview, , "
dbo.Teacher.Code='Peter' "
It throws an error :
"The column prefix 'dbo.Teacher' does not match with a
table name or alias name used in the query"
because there are 2 fields name is "Code" (one in Student
Table and one is Teacher Table) so I have to use Table
Name (to different them).
Notes :I don't want to write (get from Student.TeacherCode)
Docmd.OpenReport "rptClass", acViewPreview, , "
dbo.TeacherCode='Peter' "
Thank a lot
as back end .
I have 2 tables : [Student] and [Teacher] . I want to
query whole student of a teacher (for example : "Peter") .
I make a query that:
Student(Code,Name,Description,TeacherCode)
Teacher(Code,Name,Description)
"Select * from dbo.Teacher INNER JOIN dbo.Student ON
dbo.Teacher.Code=dbo.Student.TeacherCode"
when I use [WhereCondition] in Docmd.OpenReport. I write
Docmd.OpenReport "rptClass", acViewPreview, , "
dbo.Teacher.Code='Peter' "
It throws an error :
"The column prefix 'dbo.Teacher' does not match with a
table name or alias name used in the query"
because there are 2 fields name is "Code" (one in Student
Table and one is Teacher Table) so I have to use Table
Name (to different them).
Notes :I don't want to write (get from Student.TeacherCode)
Docmd.OpenReport "rptClass", acViewPreview, , "
dbo.TeacherCode='Peter' "
Thank a lot