eltoro > 13-01-16, 09:58 AM
Option Compare Database
Function Diemchuan(MaNganh As String, Chitieu As Integer) As Single
Dim strQSL As String 'Luu cau lenh SQL
Dim rs As Recordset
On Error Resume Next
strSQL = "SELECT TOP "&Chitieu&" [SumDiem], MaNganh FROM THISINH "&_
"WHERE (((THISINH.MaNganh)='"&MaNganh&"')) ORDER BY [SumDiem] DESC"
Set rs = CurrenDb.OpenRecordset(strSQL, 2)
rs.MoveLast
Diemchuan = rs.Fields("SumDiem")
rs.Close
Set rs = Nothing
End Function
ongke0711 > 13-01-16, 01:19 PM