【问题标题】:MS ACcess Make textboxes visible upon button clickMS ACcess 使文本框在按钮单击时可见
【发布时间】:2012-06-01 18:56:49
【问题描述】:

在每次单击按钮时,我都希望能够使 4 个文本框和 4 个标签“可见”。我不知道如何使用 VBA 代码来做到这一点。

这是我迄今为止尝试过的: 没有产生错误,但我不知道如何从这里开始。

Private Sub Command36_Click()

Static Counter As Integer
Dim Name As String
Dim Name2 As String
Dim Count As Integer

Counter = Counter + 1

Name = "Label" & Counter
Name2 = "Text" & Counter
Command36.Caption = Name & Name2

For Count = 1 To Count = Counter

Microsoft Access 表单、VBS

【问题讨论】:

    标签: ms-access vba ms-access-2003


    【解决方案1】:

    我想你的意思是:

    Private Sub Command36_Click()
    Dim Name As String
    Dim Name2 As String
    Dim Count As Integer
    
    
       For Count = 1 To 4
          Name = "Label" & Counter
          Name2 = "Text" & Counter
          Command36.Caption = Name & Name2
       Next
    
    End Sub
    

    我不太明白上面的意思。

    这可能更有用,如果如你所说,你想让某些东西可见:

       For Count = 1 To 4
          Name1 = "Label" & Counter
          Name2 = "Text" & Counter
          Me(Name1).Visible = True
          Me(Name2).Visible = True
       Next
    

    帮自己一个忙,确保为控件提供“真实”名称,而不是 Command36,而是 cmdShowLabel 之类的名称

    【讨论】:

    • 感谢您的帮助!我打算在测试运行完成后将名称更改为“真实姓名”。
    • 好主意。还要注意保留字。 Name 特别是对于任何事物来说都是一个危险的名字,所以我希望它只是一个例子。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多