Retrieving value from a textbox

I am trying to retrieve value from a textbox dynamically.

This code isn't working.

For i = 1 To TotalSheets

    ReqValue = ValidationForm.Frame6.ReportName(i).Value


Next

But this code does,

ReqValue = ValidationForm.Frame6.ReportName1.Value

I need to get the values dynamically through a loop.

Upvotes: 0

Views: 55

Answers (1)

iSpain17
iSpain17

Reputation: 3053

Reportname(i) refers to an array.

Instead, you have to concatenate the name of your control:

ValidationForm.Frame6.Controls(“ReportName” & i).Value

Upvotes: 3

Related Questions