mLennon
02-23-2017, 12:42 AM
Hi guys,
Sorry, again a newbie that has very limited skills in programming.
I work for a company that produces some 'widgets'. We work a 10 hour shift and we record how much we produce each hour.
I planned to capture the shift in a Class - cls_shiftClass which will store details about the shift, eg. date, start time, plant operator, shift supervisor etc. Then inside the shift Class to also include another class for the hours work - cls_hourClass. Inside the hourClass, I was storing the start time, end time, raw material in, product material out, and any rejects amongst other things. I planned to add 10 hours...
simply:
set hour1 = new cls_hourClass
set hour2 = new cls_hourClass
etc...
I thought this was a better model so that I could perform calculations based on the hour, a 2hr grouping, half shift and full shift all by using the raw hourly data.
My problem is I know how to create a custom class and set properties on that, I don't know where to start to declare a class with properties inside a class... and how to access the properties of the nested class.
I have tried this in my cls_shiftClass:
Private Sub Class_Initialize()
Debug.Print "Initialising the cls_shiftClass"
Set hour1 = New cls_hourData
hour1.rejectWidgets = 81
Me.ProductionData.Add hour1
Debug.Print Me.ProductionData(0) & " was the value in rejectWidgets in the Shift Module" ' // no data returned
Debug.Print Me.hour1.rejectWidgets & " was the value in rejectWidgets in the Shift Module" ' // 0 was the value in the rejectWidgets
End Sub
I don't know where to begin.
Appreciate any guidance.
Thanks.
M
Sorry, again a newbie that has very limited skills in programming.
I work for a company that produces some 'widgets'. We work a 10 hour shift and we record how much we produce each hour.
I planned to capture the shift in a Class - cls_shiftClass which will store details about the shift, eg. date, start time, plant operator, shift supervisor etc. Then inside the shift Class to also include another class for the hours work - cls_hourClass. Inside the hourClass, I was storing the start time, end time, raw material in, product material out, and any rejects amongst other things. I planned to add 10 hours...
simply:
set hour1 = new cls_hourClass
set hour2 = new cls_hourClass
etc...
I thought this was a better model so that I could perform calculations based on the hour, a 2hr grouping, half shift and full shift all by using the raw hourly data.
My problem is I know how to create a custom class and set properties on that, I don't know where to start to declare a class with properties inside a class... and how to access the properties of the nested class.
I have tried this in my cls_shiftClass:
Private Sub Class_Initialize()
Debug.Print "Initialising the cls_shiftClass"
Set hour1 = New cls_hourData
hour1.rejectWidgets = 81
Me.ProductionData.Add hour1
Debug.Print Me.ProductionData(0) & " was the value in rejectWidgets in the Shift Module" ' // no data returned
Debug.Print Me.hour1.rejectWidgets & " was the value in rejectWidgets in the Shift Module" ' // 0 was the value in the rejectWidgets
End Sub
I don't know where to begin.
Appreciate any guidance.
Thanks.
M