اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

كود عمل علاقة بين جدولين وايضاً طباعة العلاقات


alswedi

الردود الموصى بها

هذا هو الكود للربط

و أيضا كود لطباعة العلاقات الي نافذة ال debug

 

'create a relation 
'================= 
Sub CreateRelationDAO() 
Dim dbsLocal As Database 
Dim relLocal As Relation 
Dim fldLocal As Field 

Set dbsLocal = CurrentDb 
Set relLocal = dbsLocal.CreateRelation() 
With relLocal 
.Name = "PeopleFood" 
.Table = "tblFoods" 
.ForeignTable = "tblPeople" 
.Attributes = dbRelationDeleteCascade 
End With 
Set fldLocal = relLocal.CreateField("FoodID") 
fldLocal.ForeignName = "FoodID" 
relLocal.Fields.Append fldLocal 
dbsLocal.Relations.Append relLocal 
End Sub 

'print relation 
'================ 
Sub EnumRelations() 
Dim dbsLocal As Database 
Dim relLocal As Relation 

Set dbsLocal = CurrentDb 
For Each relLocal In dbsLocal.Relations 
Debug.Print relLocal.Table & " Related To: " & relLocal.ForeignTable 
Next relLocal 
End Sub

رابط هذا التعليق
شارك

من فضلك سجل دخول لتتمكن من التعليق

ستتمكن من اضافه تعليقات بعد التسجيل



سجل دخولك الان
  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information