我正在尝试在主窗体中嵌入的子窗体(frmeffortimpact)上创建一个按钮(frmProjectCharter01)。简单地说,我希望该按钮可以打开和关闭AllowAdditions属性。不幸的是,我收到语法错误消息,代码如下:
Private Sub cmdAddImpacts_Click()
If Me.Forms("frmProjectCharter01").Forms("frmeffortimpact").AllowAdditions = True Then
Me![frmEffortImpact].Form.AllowAdditions = False
Me.Immagine52 = True
Me.Immagine55 = False
ElseIf Me.Forms("frmProjectCharter01").Form("frmeffortimpact").AllowAdditions = False Then
Me![frmEffortImpact].Form.AllowAdditions = True
Me.Immagine52 = False
Me.Immagine55 = True
End If
End Sub
答案 0 :(得分:1)
我过度复杂了。以下是我的问题的答案:
Private Sub cmdAddImpacts_Click()
If Me.AllowAdditions = True Then
Me.AllowAdditions = False
Me.Immagine52.Visible = True
Me.Immagine55.Visible = False
ElseIf Me.AllowAdditions = False Then
Me.AllowAdditions = True
Me.Immagine52.Visible = False
Me.Immagine55.Visible = True
End If
End Sub