- Local time
- Today, 15:52
- Joined
- Jul 9, 2003
- Messages
- 17,394
The commented out part of code is from MS Access help and works OK.
The part below that is my attempt at extracting (enumerating) through the properties of a control. It doesn't work! Seems to me that I've had problems with this before, and my suspicion is that it's not possible, however I thought I would ask here.
The simple question is:
Is it possible to examine the properties of a control as a "collection"?
Your thoughts and observations appreciated.... (more information below if anyone is interested)
I have passed the "instance?" of a control from one form (calling form) to another (called form). I pass it into a custom property in the other form (again called form) .
I now want to display the information within that control (a combo box) on another combo box displayed on my form (the called form). So in effect I need to set the properties of the combo box on the "called form" to the same as the combo box on the calling form".
I believe this would be a simple matter if I could access the properties collection of the control, and also the properties collection of the custom property. But I don't think it's possible.
I have thought of a way round the problem, I will extract that property names individually into an array, and then individually set them there. Then pass the values back into the control. This seems a bit long winded, I wondered if anyone had any observations before I embark on this tortuous project.
The part below that is my attempt at extracting (enumerating) through the properties of a control. It doesn't work! Seems to me that I've had problems with this before, and my suspicion is that it's not possible, however I thought I would ask here.
The simple question is:
Is it possible to examine the properties of a control as a "collection"?
Your thoughts and observations appreciated.... (more information below if anyone is interested)
Code:
'' Dim frm As Form, prp As Property
''
'' ' Enumerate Forms collection.
'' For Each frm In Forms
'' ' Print name of form.
'' MsgBox " >>> " & frm.Name
'' ' Enumerate Properties collection of each form.
'' For Each prp In frm.Properties
'' ' Print name of each property.
'' If Left(prp.Name, 1) = "p" Then
'' MsgBox " >>> " & prp.Name & " = " & prp.Value
'' End If
'' Next prp
'' Next frm
Dim Ctrl As Control
Dim prp As Property
For Each prp In cboDefaults
MsgBox " >>> " & prp.Name '& " = " & prp.Value
Next prp
I have passed the "instance?" of a control from one form (calling form) to another (called form). I pass it into a custom property in the other form (again called form) .
I now want to display the information within that control (a combo box) on another combo box displayed on my form (the called form). So in effect I need to set the properties of the combo box on the "called form" to the same as the combo box on the calling form".
I believe this would be a simple matter if I could access the properties collection of the control, and also the properties collection of the custom property. But I don't think it's possible.
I have thought of a way round the problem, I will extract that property names individually into an array, and then individually set them there. Then pass the values back into the control. This seems a bit long winded, I wondered if anyone had any observations before I embark on this tortuous project.