tranthanhan1962 > 05-04-15, 11:16 PM
maidinhdan > 06-04-15, 01:05 AM
Private Sub cbnaplist_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' Ten nay khong co trong Danh sach " & vbCrLf & vbCrLf
strMsg = strMsg & "Ban co muon them ten nay vao khong?"
strMsg = strMsg & vbCrLf & vbCrLf & "Nhan Yes de dong y hoac No de go lai."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Them ten moi?") = vbNo Then
Response = acDataErrContinue
Exit Sub
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("TableBangDanhSach", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!MaDS = NewData 'Muon them cot nao thi chen o day'
rs.Update
If Err Then
MsgBox "Ten nay da ton tai, Xin nhap ten khac vao."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
tranthanhan1962 > 06-04-15, 06:27 PM
maidinhdan > 06-04-15, 06:44 PM
Xuân Thanh > 07-04-15, 05:06 PM
amazonvn82 > 08-08-15, 12:34 AM