登録システムを開発しています。しかし、私はこのエラーを受け取っています:You tried to execute a query that does not include the specified expression..
次のコードを使用しています。
Private Function RefreshAdvisoryList()
Dim vRS As New ADODB.Recordset
Dim sSQL As String
'clear list
txtsection.Clear
'On Error GoTo ReleaseAndExit
sSQL = "SELECT tblSection.SectionID, tblSection.SectionTitle, tblAdviser.SchoolYear, tblDepartment.DepartmentTitle, tblYearLevel.YearLevelTitle, tblAdviser.TeacherID" & _
" FROM (tblDepartment INNER JOIN (tblYearLevel INNER JOIN tblSection ON tblYearLevel.YearLevelID = tblSection.YearLevelID) ON tblDepartment.DepartmentID = tblSection.DepartmentID) INNER JOIN tblAdviser ON (tblSection.SectionID = tblAdviser.SectionID) AND (tblDepartment.DepartmentID = tblAdviser.DepartmentID)" & _
" GROUP BY tblSection.SectionID, tblSection.SectionTitle, tblAdviser.SchoolYear, tblDepartment.DepartmentTitle, tblYearLevel.YearLevelTitle, tblAdviser.TeacherID" & _
" HAVING (((tblTeacher.TeacherID)='" & curTeacher.TeacherID & "') AND tblSection.SchoolYear='" & Me.txtSchoolYear.Text & "')" & _
" ORDER BY tblAdviser.SchoolYear DESC;"
If ConnectRS(con, vRS, sSQL) = False Then
'fatal
'temp
MsgBox "Unable to connect Teacher's Advisory Recordset.", vbCritical
'GoTo ReleaseAndExit
End If
If AnyRecordExisted(vRS) = True Then
While vRS.EOF = False
txtsection.AddItem vRS!SectionTitle
vRS.MoveNext
Wend
End If
'Exit Function
'ReleaseAndExit:
' Set vRS = Nothing
End Function
このスクリーンショットを見てください。