Hi, I built a lstTutor in a form and would like to list the selected tutor with its appointment history in sbfApptHistory (subform). I have no idea of creating fields for it with VBA codes and just created a blank subform.
tblTutor = tutor's table for peronsal particulars
tblTAppt = tutor's appointment table
tblTRank = tutor's staff rank
The tutors are added to lstTutor with a condition from fraOption.
I used a SQL below and Me.sbfApptHistory.Form.RecordSource = SQL
SQL = "SELECT tblTAppt.TRef, tblTAppt.UID, tblTAppt.ApptStart_Dt, tblTAppt.ApptStart_Dt, tblTAppt.ApptEnd_Dt, tblTAppt.AppointedBy, tblTAppt.JobPosition, tblTRank.HDesc " & _
"FROM (tblTAppt INNER JOIN tblTutor ON tblTAppt.TRef = tblTutor.TRef) INNER JOIN tblTRank ON tblTAppt.RankCode = tblTRank.ID " & _
"WHERE tblTAppt.TRef = " & lstTutor.Column(0) & " " & _
"ORDER BY tblTAppt.ApptEnd_Dt DESC"
However, I run into an error of "2467", "the expression you entered refers to an object that is closed or doesn't exist".
I don't know why. Welcome any idea on this.
tblTutor = tutor's table for peronsal particulars
tblTAppt = tutor's appointment table
tblTRank = tutor's staff rank
The tutors are added to lstTutor with a condition from fraOption.
I used a SQL below and Me.sbfApptHistory.Form.RecordSource = SQL
SQL = "SELECT tblTAppt.TRef, tblTAppt.UID, tblTAppt.ApptStart_Dt, tblTAppt.ApptStart_Dt, tblTAppt.ApptEnd_Dt, tblTAppt.AppointedBy, tblTAppt.JobPosition, tblTRank.HDesc " & _
"FROM (tblTAppt INNER JOIN tblTutor ON tblTAppt.TRef = tblTutor.TRef) INNER JOIN tblTRank ON tblTAppt.RankCode = tblTRank.ID " & _
"WHERE tblTAppt.TRef = " & lstTutor.Column(0) & " " & _
"ORDER BY tblTAppt.ApptEnd_Dt DESC"
However, I run into an error of "2467", "the expression you entered refers to an object that is closed or doesn't exist".
I don't know why. Welcome any idea on this.