Working on this, thought i’d ask around…
I want to create a button that will load user edit controls with data from companion controls that only display preloaded data. one way to identify the preloaded controls is to add a tag to them, and this allows me to cycle thru and find the name/value pairs for the preloaded data.
the fun begins when i try to assemble a control name in code and assign it the value fetched:
[codebox]Private Sub btnValuesToUserEdits_Click()
Dim UserCtlString As String
Dim UserCtl As Control
Dim ctl As Control
For i = 0 To 7
For Each ctl In Me.MainTab.Pages(i).Controls
With ctl
If .Tag = “OR” Then
ControlName = .Name
ControlValue = .Value
UserCtlString = “UE_” & ControlName <– this gives me a valid control name
UserCtl = UserCtlString <– this doesn't work
UserCtl.Value = ControlValue
End If
End With
Next
Next i
End Sub[/codebox]
Essentially I want a variable that specifies an existing control, find the control and load it with the value in the tagged control. now, perhaps this is going to have to be some sort of array to load value/pairs and an additional array to step thru controls and map the values but i was hoping to do this in a single loop. no good reason, just seems a lot easier. That doesn't mean it can be done, of course…
TIA