MS Acess循环,将x添加到复选框

时间:2017-07-25 18:48:27

标签: access-vba

需要一些帮助在访问中循环复选框。我有三个复选框,checkbox1,checkbox2,checkbox3。 x = 1 我无法通过“check”& x或checkx或check(x) 有没有办法用数字变量x?

声明复选框名称

谢谢!

Private Sub Refer_Click()
Dim x As Integer
Dim y As String

x = 1
y = ""

Do Until x = 4
    If Checkx = True Then
      y = y & Checkx.Controls(0).Caption & ";"
      x = x + 1
    Else: 
      x = x + 1
      y = "unchecked"
End If
Loop

fillThis.Value = y


End Sub

1 个答案:

答案 0 :(得分:1)

假设您在表单上有10个复选框,每个复选框都命名为“chk”加上序列号,您可以使用以下内容:

<dependency>
  <groupId>org.apache.maven</groupId>
  <artifactId>maven-plugin-api</artifactId>
  <version>3.5.0</version>
</dependency>
<dependency>
  <groupId>org.twdata.maven</groupId>
  <artifactId>mojo-executor</artifactId>
  <version>2.3.0</version>
</dependency>
<dependency>
  <groupId>org.apache.maven.plugin-tools</groupId>
  <artifactId>maven-plugin-annotations</artifactId>
  <version>3.5</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>org.eclipse.aether</groupId>
  <artifactId>aether-api</artifactId>
  <version>1.1.0</version>
</dependency>
<dependency>
  <groupId>org.apache.maven</groupId>
  <artifactId>maven-core</artifactId>
  <version>3.5.0</version>
</dependency>
<dependency>
  <groupId>org.apache.maven</groupId>
  <artifactId>maven-compat</artifactId>
  <version>3.5.0</version>
</dependency>
<!--Test Dependencies-->
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.apache.maven.plugin-testing</groupId>
  <artifactId>maven-plugin-testing-harness</artifactId>
  <version>3.3.0</version>
  <scope>test</scope>
</dependency>