如何使用 vba Access 更改 ActiveControl 属性?
How can I change ActiveControl properties using vba Access?
我创建了这个 sub 来根据 ActiveControl
CommandButton
进行一些格式化
Sub ReFormat(Sender As CommandButton)
'Me.PictureBox.Picture = Me.Controls(Sender).Picture
Me.PictureBox.Picture = Sender.Picture
Me.lbl.Caption = Sender.Caption
Sender.PictureCaptionArrangement = acRight
Sender.FontBold = True
Sender.ForeColor = RGB(45, 48, 60)
End Sub
并从 :
调用它
Private Sub Command0_Click()
ReFormat (ActiveControl)
End Sub
它抛出这个错误
我试过了
Sub ReFormat(Sender As Object)
Sub ReFormat(Sender As Control)
还是一样。
我做错了什么?
括号使其成为read-only。尝试:
ReFormat ActiveControl
我创建了这个 sub 来根据 ActiveControl
CommandButton
Sub ReFormat(Sender As CommandButton)
'Me.PictureBox.Picture = Me.Controls(Sender).Picture
Me.PictureBox.Picture = Sender.Picture
Me.lbl.Caption = Sender.Caption
Sender.PictureCaptionArrangement = acRight
Sender.FontBold = True
Sender.ForeColor = RGB(45, 48, 60)
End Sub
并从 :
调用它Private Sub Command0_Click()
ReFormat (ActiveControl)
End Sub
它抛出这个错误
我试过了
Sub ReFormat(Sender As Object)
Sub ReFormat(Sender As Control)
还是一样。
我做错了什么?
括号使其成为read-only。尝试:
ReFormat ActiveControl