How to fill many texbox by using loop function in VBA

后端 未结 3 1586
忘掉有多难
忘掉有多难 2021-01-24 22:36

I made a user interface in VBA with many textbox. I read an excel sheet and I put all the value of this one in all the textbox of my user inteface. So the user can modify the va

3条回答
  •  忘掉有多难
    2021-01-24 23:22

    you can use this code to fill multi textboxs

        Dim rs As Object
        Dim i As Integer
        Dim ctlr As Control
         Set rs = Me.Recordset.Clone
         For Each ctlr In Me.Controls
         If TypeOf ctlr Is TextBox Then
          For i = 0 To ctlr.Controls.Count
          On Error Resume Next
           ctlr.Value = rs!SomeField 
           rs.MoveNext
          Next i
        End If
    
    Next
    

提交回复
热议问题