如何在VBA Access中将文本框放在for循环中?
txta1=a(1)
txta2=a(2)
txta3=a(3)
我们在FoxPro中有:
txta&i =a(i)
答案 0 :(得分:3)
试试这个
for i=1 to n
me.controls("txta" & i)=a(i)
next i
答案 1 :(得分:0)
Thank you but I couldn't solve my problem.This code is working:
Sub test()
Dim a(40) As Integer
a(1) = "1"
a(2) = "2"
a(3) = "3"
DoCmd.OpenForm "FR_Certificate", acViewLayout
With Forms![FR_Certificate]
.txta1.Value = a(1)
.txta2.Value = a(2)
.txta3.Value = a(3)
End With
End Sub
but when I change
.txta1.Value = a(1)
.txta2.Value = a(2)
.txta3.Value = a(3)
with
For i = 1 To 3
Me.Controls(."txta" & i.value) = a(i)
Next i
I got synntax error.