Private Sub cmdkhvapt_Click()
On Error GoTo loi
Dim db As DAO.Database
Dim rls As DAO.Relation
Set db = CurrentDb
Set rls = db.CreateRelation("TaoQuanHe9", "KhachHang", "PhieuThu", dbRelationUpdateCascade)
rls.Fields.Append rls.CreateField("MaKH")
rls.Fields("MaKH").ForeignName = "MaKH"
db.Relations.Append rls
loi:
If Err.Number = 3012 Then
MsgBox "Da ton tai quan he nay!"
End If
End Sub
Posted in: access
0 nhận xét:
Đăng nhận xét