Robynsveil
New Member
- Joined
- Jan 11, 2013
- Messages
- 3
Hi. I've been struggling with the concept described in the title for a bit.
What I had =>
I have this little Excel-based 3-form application to manage assets in my department. The initial form displays a listbox of asset items (equipment) and their status (in-service, in-repair, etc.). The equipment is segregated (grouped) by which sort of equipment it is, whether diagnostic, antithrombotic, med-delivery, etc with a 2-character code associated with each type... what displays in the listbox is driven by a "EquipmentType" combobox at the top of the form. At this point - my understanding of arrays being at the extreme-neophyte stage: I'm a nurse, not a programmer, yet
- I would populate my combobox in a udf thus:
Then, call this from the combobox:
... to get the appropriate code for the type of equipment. I know - very kludgy.
Progress so far =>
So, what I've been doing is converting all my global variables - ones that can be seen and manipulated from sub-forms - to properties of the form with Let / Get property statements in the form, like this...
In the variable declaration section where the globals were formerly defined:
and then the Let / Gets:
And yay, all this works: what were global variables are now properties exposed to my whole app, which I wanted. But.
What I want to do=>
I sort-of want to fix my combobox behaviour to make a 2-dimentional array where the array itself is a property of the form (and thus, accessible anywhere I need it) and populate my combobox with the first element of:
I did try the rowsource property and controlsource property for the combobox but didn't like how Excel 2000 worked and how it looked.
Thank you to any and all who take the time to consider my little conundrum and even more thanks to those who respond. I've seen a lot of different solutions on Chip Pearson's site involving setting up a class module, but they seem more like solutions for collections for dynamic arrays: mine is a finite list and I had trouble adapting what I read to my problem.
Thanks again!
What I had =>
I have this little Excel-based 3-form application to manage assets in my department. The initial form displays a listbox of asset items (equipment) and their status (in-service, in-repair, etc.). The equipment is segregated (grouped) by which sort of equipment it is, whether diagnostic, antithrombotic, med-delivery, etc with a 2-character code associated with each type... what displays in the listbox is driven by a "EquipmentType" combobox at the top of the form. At this point - my understanding of arrays being at the extreme-neophyte stage: I'm a nurse, not a programmer, yet

Code:
Dim aList(0 To 12) As String
aList(0) = "Anaesthetic"
aList(1) = "Appliances"
aList(2) = "Antithrombotic"
aList(3) = "Diagnostic"
aList(4) = "Gases-Medical"
aList(5) = "Other"
aList(6) = "Medication Delivery"
aList(7) = "Monitoring"
aList(8) = "Patient Warming"
aList(9) = "Resusitation"
aList(10) = "Suction"
aList(11) = "Trolleys-Stands"
With myForm.CboEqType
.Clear
For i = 0 To 11
.AddItem (aList(i))
Next i
.ListIndex = 0
End With
EquipTypeList = aList(0)
Then, call this from the combobox:
Code:
Public Function GetEquipAbbr(TypeName As String) As String
Select Case TypeName
Case "Anaesthetic"
GetEquipAbbr = "AN"
Case "Appliances"
GetEquipAbbr = "AP"
Case "Antithrombotic"
GetEquipAbbr = "AT"
Case "Diagnostic"
GetEquipAbbr = "DI"
Case "Gases-Medical"
GetEquipAbbr = "GM"
Case "Other"
...
End Select
End Function
... to get the appropriate code for the type of equipment. I know - very kludgy.

Progress so far =>
So, what I've been doing is converting all my global variables - ones that can be seen and manipulated from sub-forms - to properties of the form with Let / Get property statements in the form, like this...
In the variable declaration section where the globals were formerly defined:
Code:
Private pWkSht, pSrchType ...etc... As String
and then the Let / Gets:
Code:
Public Property Get WkSht() As String
WkSht = pWkSht
End Property
Public Property Let WkSht(lWkSht As String)
pWkSht = lWkSht
End Property
Public Property Get SrchType() As String
SrchType = pSrchType
End Property
Public Property Let SrchType(lSrchType As String)
pSrchType = lSrchType
End Property
And yay, all this works: what were global variables are now properties exposed to my whole app, which I wanted. But.
What I want to do=>
I sort-of want to fix my combobox behaviour to make a 2-dimentional array where the array itself is a property of the form (and thus, accessible anywhere I need it) and populate my combobox with the first element of:
Code:
With myForm
.gcArrET(0, 0) = "Anaesthetic"
.gcArrET(0, 1) = "AN"
.gcArrET(1, 0) = "Appliances"
.gcArrET(1, 1) = "AP"
.gcArrET(2, 0) = "Antithrombotic"
.gcArrET(2, 1) = "AT"
.gcArrET(3, 0) = "Diagnostic"
.gcArrET(3, 1) = "DI"
.gcArrET(4, 0) = "Gases-Medical"
.gcArrET(0, 0) = "GM"
.gcArrET(5, 1) = "Other"
.gcArrET(0, 1) = "OT"
...
.CboEqType.Clear
For i = 0 To 11
.CboEqType.AddItem (.gcArrET(i))
Next i
' Forces showing of the first item in the cboBox,
' which also runs PopInvList()
.CboEqType.ListIndex = 0
End With
I did try the rowsource property and controlsource property for the combobox but didn't like how Excel 2000 worked and how it looked.
Thank you to any and all who take the time to consider my little conundrum and even more thanks to those who respond. I've seen a lot of different solutions on Chip Pearson's site involving setting up a class module, but they seem more like solutions for collections for dynamic arrays: mine is a finite list and I had trouble adapting what I read to my problem.
Thanks again!

Last edited: