从Access子窗体中提取数据:运行时错误438

问题描述 投票:0回答:1

当我单击“ Calculate Total”按钮(昨天有效时,我得到

运行时错误438对象不支持此属性或方法。

该代码位于表单中的按钮单击事件上,并引用该表单中的几个不同子表单。我试图重建代码和主要形式。

Private Sub Command91_Click()

Me.Plates = Me.MealPlannerSubformsf!TotalMeals
Me.MealSubtotal = Me.Plates * Me.MealRate
Me.Sleeps = Me.LodgingDetailsSubformsf!TotSleepers
Me.LodgingSubtotal = Me.Sleeps * Me.LodgingRate
Me.ExpectedTotal = Me.MealSubtotal + Me.LodgingSubtotal + Me.ReservationFee

End Sub
access-vba
1个回答
0
投票

您必须通过子表单的Form属性访问控件:

Private Sub Command91_Click()

Me.Plates = Me.MealPlannerSubformsf.Form!TotalMeals
Me.MealSubtotal = Me.Plates * Me.MealRate
Me.Sleeps = Me.LodgingDetailsSubformsf.Form!TotSleepers
Me.LodgingSubtotal = Me.Sleeps * Me.LodgingRate
Me.ExpectedTotal = Me.MealSubtotal + Me.LodgingSubtotal + Me.ReservationFee

End Sub
© www.soinside.com 2019 - 2024. All rights reserved.