[英]Store Record from Container Form Into Subforms Table
如果將表格綁定到CountryID上,它將自動在新記錄中插入CountryID。
在VBA中,您可以使用子表單中的方法
Private Sub Form_BeforeInsert(Cancel As Integer)
'left hand site the foreign key and Right hand site map to parent id
Me!TerritoryID = [Forms]![frmInput]!...TerritoryID
End Sub
引用父表單字段的另一種VBA方式:
Me!TerritoryID = Me.Parent!TerritoryID
另一種解決方案是僅使用子窗體中的屬性。 只需使用“ 鏈接子字段”和“ 鏈接主字段”,並用來自父級和子級的兩個Key 字段填充tit。
此鏈接有些舊,但在新版本的Access中仍然有效: http : //www.techonthenet.com/access/subforms/refresh.php
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.