Phung Duc > 02-11-16, 11:43 AM
Minh Tiên > 02-11-16, 03:17 PM
Public Sub SanXuat()
Dim rs_NhomSX As DAO.Recordset
Dim strSQL As String
Dim TuanSX As String
Dim NhomSX As String
Dim Chuyen As String
Dim Tennhom As String
Dim Nh As String
TuanSX = [Forms]![FormsSanXuat]![txtTuanSX]
NhomSX = [Forms]![FormsSanXuat]![txtNhomSX]
strSQL = "SELECT NhomSX.* FROM NhomSX WHERE (((Tuan)='" & TuanSX & "') AND ((Nhom)='" & NhomSX & "')) Order by Chuyen;"
Set rs_NhomSX = CurrentDb.OpenRecordset(strSQL)
If rs_NhomSX.RecordCount > 0 Then
Nh = ""
rs_NhomSX.MoveFirst
Do While Not rs_NhomSX.EOF
Chuyen = Nz(rs_NhomSX!Chuyen)
Tennhom = Nz(rs_NhomSX!Nhom)
Nh = Nh & "-" & Right(Chuyen, 3)
rs_NhomSX.MoveNext
Loop
MsgBox Tennhom & Nh 'Thay bằng câu Update ghi vào cột TennhomSX
Else
msgbox "Khong có số liệu !"
End If
End Sub