leehoang2011 > 17-07-21, 06:36 PM
ongke0711 > 17-07-21, 07:21 PM
tungthoi15 > 17-07-21, 10:08 PM
(17-07-21, 06:36 PM)leehoang2011 Đã viết: ...
Else
If (DCount("Macd", "ChiDoan", "Macd='" & Macd & "'") = 1) And (DCount("Namhoc", "ChiDoan", "Namhoc='" & Namhoc & "'") = 1) Then
MsgBox "Trong nam hoc ma chi doan da co. Vui long nhap lai"
Macd.SetFocus
Else
DoCmd.RunCommand acCmdSaveRecord
ListCD.Requery
End If
End If
End Sub
cpucloi > 17-07-21, 10:38 PM
If (DCount("Macd", "ChiDoan", "Macd='" & Macd & "'") = 1) And (DCount("Namhoc", "ChiDoan", "Namhoc='" & Namhoc & "'") = 1) Then
MsgBox "Trong nam hoc ma chi doan da co. Vui long nhap lai"
Macd.SetFocus
tranthanhan1962 > 17-07-21, 11:23 PM
ongke0711 > 17-07-21, 11:30 PM
doandinhtam > 19-07-21, 06:38 PM
Private Sub Macd_AfterUpdate()
If DCount("[Macd]", "Chidoan", "[Macd] = Macd.Value") > 0 and DCount("[Namhoc]", "Chidoan", "[Namhoc] = Namhoc.Value") > 0 Then
MsgBox "Trong nam hoc ma chi doan da co. Vui long nhap lai"
Macd.SetFocus
end if
end sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo BeforeUpdate_Error
If Me.Dirty Then
'if record has been changed the dirty property
'is set to true Display message to save the record
If MsgBox("Co luu thay doi khong?", _
vbYesNo + vbQuestion, "Save Changes") = vbNo Then
Me.Undo
End If
End If
BeforeUpdate_Exit:
Exit Sub
BeforeUpdate_Error:
MsgBox Err.Description
Resume BeforeUpdate_Exit
End Sub