papito > 02-05-14, 10:10 AM
anhemnhangu > 02-05-14, 11:00 AM
papito > 02-05-14, 11:13 AM
trunghieu > 02-05-14, 06:33 PM
papito > 03-05-14, 09:49 AM
papito > 04-05-14, 10:23 PM
papito > 05-05-14, 08:36 AM
MTNQ > 05-05-14, 01:58 PM
Private Sub cmdThem_Click()
On Error GoTo Err_cmdThem_Click
If Nz(Me!HOTEN, "") = "" Then
MsgBox "Ho Ten: Khong duoc bo trong "
Me!HOTEN.SetFocus
Exit Sub
End If
If Nz(Me!DIACHI, "") = "" Then
MsgBox "Dia Chi: Khong duoc bo trong "
Me!DIACHI.SetFocus
Exit Sub
End If
If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , "", acNewRec
Me!HOTEN.SetFocus
Exit_cmdThem_Click:
Exit Sub
Err_cmdThem_Click:
MsgBox Err.Description
Resume Exit_cmdThem_Click
End Sub
Private Sub cmdThem_Click()
On Error GoTo Err_cmdThem_Click
Dim strCtrlNames As String, Ctrl As Control, Arr As Variant
strCtrlNames = "HOTEN,DIACHI" 'Tên các điều khiển không được bỏ trống cách nhau bằng dấu phẩy
Arr = Split(strCtrlNames, ",")
For i = LBound(Arr) To UBound(Arr)
Set Ctrl = Controls(Arr(i))
If Nz(Ctrl, "") = "" Then
MsgBox Ctrl.ValidationText, , "Luu Y!" 'Nhập câu cần thông báo vào thuộc tính ValidationText của điều khiển
Ctrl.SetFocus
Exit Sub
End If
Next
If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , "", acNewRec
Me!HOTEN.SetFocus
Exit_cmdThem_Click:
Exit Sub
Err_cmdThem_Click:
MsgBox Err.Description
Resume Exit_cmdThem_Click
End Sub