Disable cho nút lệnh

Cách Disable (vô hiệu hóa) cho nút lệnh trong Form VBA Access

Bạn đang lập trình 1 phần mềm, khi mở form lên, muốn tất các nút lệnh disable (vô hiệu hóa) cho nút lệnh trong Form VBA Access, hãy sử dụng đoạn ví dụ code VBA bên dưới

Private Sub Command9_Click()
'ListControlProps Me


Dim Ctrl As Control

    For Each Ctrl In Me.Controls
         tenControl = Ctrl.Properties("Name")
         If tenControl = "Command1" Then
            Ctrl.Enabled = False
         End If
         
    Next Ctrl

End Sub