Originally Posted by
Denjam
Thanks but that didn't work, i want to use the datepart function but it is given me errors. the error states that no parameter set.
sqlstr="SELECT Lecturer.LastName, Items.ItemName, Assignments.Date_of_Request
FROM Lecturer INNER JOIN (Items INNER JOIN Assignments ON Items.ItemCode = Assignments.ItemCode) ON Lecturer.LectId = Assignments.LectID where datepart("m",date_of_request)"= & 4
i keep getting errors can you please help me out.
This code should work (USING THE MONTH FUNCTION)
Code:
sqlstr="SELECT Lecturer.LastName, Items.ItemName,
Assignments.Date_of_Request
FROM Lecturer INNER JOIN
(Items INNER JOIN Assignments ON Items.ItemCode = Assignments.ItemCode)
ON Lecturer.LectId = Assignments.LectID
WHERE ((Month([date_of_request])=4));"
This code should also work (USING THE DATEPART FUNCTION)
Code:
sqlstr="SELECT Lecturer.LastName, Items.ItemName,
Assignments.Date_of_Request
FROM Lecturer INNER JOIN
(Items INNER JOIN Assignments ON Items.ItemCode = Assignments.ItemCode)
ON Lecturer.LectId = Assignments.LectID
WHERE (((DatePart("m",[date_of_request]))=4));"
Therefore this is the SQL string that should be passed to the database:
Code:
sqlstr="SELECT Lecturer.LastName, Items.ItemName, " & _
" Assignments.Date_of_Request " & _
" FROM Lecturer INNER JOIN " & _
" (Items INNER JOIN Assignments ON Items.ItemCode = Assignments.ItemCode) " & _
" ON Lecturer.LectId = Assignments.LectID " & _
" WHERE ((Month([date_of_request])=" & 4 & "));"