tieuho828 > 10-12-16, 10:12 PM
tieuho828 > 03-01-17, 09:41 AM
ongke0711 > 03-01-17, 11:55 AM
Option Compare Database
Option Explicit
Const conJetDate = “\#mm\/dd\/yyyy\#"
Private Sub_cmdLoc_Click()
Dim dtNgayBD As Date, dtNgatKT As Date
Dim strWhere As String, strLoc As String
Select Case cboQuy.Value
Case 1 ‘Quy I
dtNgayBD = DateSerial (Me.txtNam-1, 11, 26)
dtNgayKT = DateSerial (Me.txtNam, 2, 25)
Case 2
dtNgayBD = DateSerial (Me.txtNam, 2, 26)
dtNgayKT = DateSerial (Me.txtNam, 5, 25)
Case 3
dtNgayBD = DateSerial (Me.txtNam, 5, 26)
dtNgayKT = DateSerial (Me.txtNam, 8, 25)
Case 4
dtNgayBD = DateSerial (Me.txtNam, 8, 26)
dtNgayKT = DateSerial (Me.txtNam, 11, 25)
End Select
strWhere = “[NgayNhapHoc] Between “ & Format (dtNgayBD, conJetDate) & “ AND “ & Format (dtNgayKT, conJetDate)
strLoc = “SELECT * FROM TableSinhVien WHERE “ & strWhere
Me.SubForm.Form.RecordSource = strLoc
Me.SubForm.Form.Requery
End Sub
cpucloi > 03-01-17, 03:54 PM