Shailendra Baranwal
Shailendra Baranwal

Reputation: 31

How to access textbox values dynamically in MS access form 2013 VB Script

I have 85 textboxes in my form of MS ACCESS 2013 with names inc_1, inc_2, inc_3 and so on....

I need to retrieve the values of these textboxes by using a loop. (of course I cannot access all textboxes individually) something like below:

dim a(1 to 85)
for i = 1 to 85
     temp ="inc_" & i
     a(i) = me.temp.value
next

This is obviously not working. Any Suggestions?

Upvotes: 1

Views: 665

Answers (1)

Gord Thompson
Gord Thompson

Reputation: 123549

The line of code you need to use is

a(i) = Me.Controls(temp).Value

Upvotes: 1

Related Questions