Kayleigh
Member
- Local time
- Today, 19:50
- Joined
- Sep 24, 2020
- Messages
- 709
Hi,
I have code to display query result as a drop-down of field but the variable Wkdy keeps popping up as error. Have I coded this wrong?
I have code to display query result as a drop-down of field but the variable Wkdy keeps popping up as error. Have I coded this wrong?
Code:
Private Sub fldSessionLogID_Enter()
Dim strSql As String
Dim Wkdy As Integer
Wkdy = Weekday(Me.fldIDate)
strSql = "SELECT DISTINCT tblSession.fldSessionID, tblSubject.fldSubjectName, qrylkpStaffNameShort.StaffShortName " & vbCrLf & _
"FROM qrylkpStaffNameShort RIGHT JOIN (tblWeekdays RIGHT JOIN (tblTerm INNER JOIN (tblSubject RIGHT JOIN ((tblRooms RIGHT JOIN (tblSession LEFT JOIN qrylkpClassName ON tblSession.fldClassID = qrylkpClassName.fldClassID) ON tblRooms.fldRoomID = tblSession.fldRoomID) LEFT JOIN jtblSessionWeekday ON tblSession.fldSessionID = jtblSessionWeekday.fldSessionID) ON tblSubject.fldSubjectID = tblSession.fldSubjectID) ON tblTerm.fldTermID = tblSession.fldTermID) ON tblWeekdays.fldWeekdayID = jtblSessionWeekday.fldWeekdayID) ON qrylkpStaffNameShort.fldStaffID = tblSession.fldStaffID " & vbCrLf & _
"WHERE (((tblTerm.fldStart)<[Forms]![frmIncidentLogList]![txtTo]) AND ((tblTerm.fldEnd)>[Forms]![frmIncidentLogList]![txtFrom]) AND ((tblWeekdays.fldWeekdayID)= Wkdy )) " & vbCrLf & _
"ORDER BY tblSubject.fldSubjectName;"
Me.fldSessionLogID.RowSource = strSql
Me.fldSessionLogID.Dropdown
End Sub