Hey guys, i was wondering if this was possible or not. I have a form call SearchCopy and a subform called SearchResultCopy, the subform is in datasheet view. On my form there is a listbox of all the controls on the subform. All the columns on the subform are hidden. When they are selected from the listbox they are unhidden.
what i'm doing now is storing the value from the listbox in a string but can't refer to that control on the subform using the string. Here's the code i'm using.
'shows fieleds that are selected from the list
Dim strFieldName As String
For itemObject = 1 To LUShowField.ListCount - 1
strFieldName = LUShowField.ItemData(itemObject)
If LUShowField.Selected(itemObject) = True Then
Forms!SearchCopy!SearchResult!strFieldName.ColumnHidden = -1
Else
Forms!SearchCopy!SearchResult!strFieldName.ColumnHidden = 0
End If
Next
from this code its looking for the field strFieldName that doesn't exist. instead that variable contains the name of the field but it apparently can't recognize that. is there any other way i can refer to that control on the subform?
i mean i can go in and type that line for every control but there are quite a bit of them which makes the code very messy looking and long. thanks
what i'm doing now is storing the value from the listbox in a string but can't refer to that control on the subform using the string. Here's the code i'm using.
'shows fieleds that are selected from the list
Dim strFieldName As String
For itemObject = 1 To LUShowField.ListCount - 1
strFieldName = LUShowField.ItemData(itemObject)
If LUShowField.Selected(itemObject) = True Then
Forms!SearchCopy!SearchResult!strFieldName.ColumnHidden = -1
Else
Forms!SearchCopy!SearchResult!strFieldName.ColumnHidden = 0
End If
Next
from this code its looking for the field strFieldName that doesn't exist. instead that variable contains the name of the field but it apparently can't recognize that. is there any other way i can refer to that control on the subform?
i mean i can go in and type that line for every control but there are quite a bit of them which makes the code very messy looking and long. thanks