Ms access MS ACcess使文本框在单击按钮时可见

Ms access MS ACcess使文本框在单击按钮时可见,ms-access,vba,ms-access-2003,Ms Access,Vba,Ms Access 2003,在每个按钮点击,我想能够使“可见”的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" & Coun

在每个按钮点击,我想能够使“可见”的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 Forms,VBS我想你的意思是:

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

的名字,谢谢你的帮助!我计划在测试运行完成后将名称更改为“真实名称”。好主意。还要注意保留的字眼<尤其是code>Name,对于任何事物来说都是一个危险的名字,所以我希望它只是一个例子。