Peter,
Either way, it's going to be complicated!
I'm afraid I don't have sufficient time to write this for you, so I'll give
you the gist of it, and hope you get the idea. You can always post more
questions to this thread.
We could store all this is a series of tables, but if it was me, I'd hard
code it.
1. Create the following procedure in the form's Load event:
Private Sub Form_Load()
Dim sStep2 As String
Dim sStep3 As String, sStep4 As String
Dim sStep5 As String, Dim sStep6 As String
Dim sStep7 As String, Dim sStep8 As String
Dim sStep9 As String, Dim sStep10 As String
'The following decimal numbers denote the required Steps.
'1 2 3 4 5 6 7 8 9 10
'The following binary equivalents are a code that represent
'each of the above numbers
'1 2 4 8 16 32 64 128 256 512
'The binary representation of the combinations of required
'steps are added to get a single number, as shown in sStep2.
'For example, if Steps 1, 2 & 3 are required, the code is calculated
as follows:
' 1=1 + 2=4 + 3=8
' =1+4+8
' =13
sStep2 = "LossType,Planned Maintenance,527,Breakdown, 831," & _
"Process Loss,863,Start Up,527,Other Downtime,655,"
& _
"Changeover,527,Machine Rework,527"
sStep3 = "Scrap,Paper Scrap,Wet Scrap,Dry Scrap"
sStep4 = "Energy,Burners Low fire,Burners Off,Fans Off"
sStep5 = "Process Step,Paper: Reelstand 1, Reelstand 2 etc..
etc..,Dry Additives: Primary System, Stucco to Mixer etc.. etc.."
sStep6 = "Breakdown Cause,Electrical: PLC, Overload,Fuse etc..
etc..,Mechanical"
sStep7 = "Process Loss,Paper Break (Lump),Paper Break (Otehr)"
sStep8 = "Other Downtime,Paper,Stucco"
sStep9 = "Action,Repair in situ,Repalce"
sStep10 = "Comments"
End Sub
You can see that the above procedure creates a bunch of string variables,
and stores all the information relating to the steps, and the combo values.
2. Unload sStep2 into a 2-column combo dataset, and set column 1's width = 0
(making it invisible). Any time you want, you can still get at column 1 by
issuing the following code:
iStepsRequired = CInt(Me.cboStep2Combo.Column(1))
3. Populate the remaining combo's in the same way.
4. When you need to decode the numbers (and thus deciding whether to make a
combo visible or invisible), do it like this:
To find out if a particular number is present in a code, logically AND
the sought number with the code. For example, if we want to find out if the
number 8 exists as part of code 831, this is what we do:
Me.cboMyCombo4.Visible = (8 AND iStepsRequired)
If 8 is indeed part of the code, the comparison will return a logical
True, otherwise it'll return False.
5. Since Step 10 is a textbox, of course there's nothing to populate, so
just make it visible or invisible, as the case may demand.
I know this seems complicated, and it is, but off the top of my head, this
seems to be the best way to do it. Perhaps others will be able to come up
with a better way.
Don't forget, if you don't understand something, or need help with any part
of it, don't hesitate to post more questions to *this thread*.
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia