📄 modhhfc.bas
字号:
choice.Adodc1.Recordset.MoveFirst
choice.Adodc1.Recordset.Find "间隔组='" & roww & "'", , adSearchForward, 1
Dim s As Integer
Dim sumtot As Long
For s = start To 20
If Len(choice.Adodc1.Recordset.Fields(s).Value) = 1 Then
sumtot = Val(choice.Adodc1.Recordset.Fields(s).Value)
Exit For
End If
Next s
If leave = 1 Then
ReDim choseenum(1 To sumtot, 1) As String
For s = 1 To sumtot
choseenum(s, 1) = choice.Adodc1.Recordset.Fields(start - 1 + s)
Next s
Else
Dim z1 As Long
Dim z2 As Long
Dim z3 As Long
z1 = 1
z2 = 1
z3 = 1
For s = 1 To sumtot
z1 = z1 * s
Next s
For s = 1 To leave
z2 = z2 * s
Next s
For s = 1 To sumtot - leave
z3 = z3 * s
Next s
Dim z4 As Long
z4 = z1 / (z2 * z3)
ReDim choseenum(1 To z4, 1 To leave) As String
If zhbiao.State = adStateClosed Then
zhbiao.Open
End If
s = 1
zhbiao.MoveFirst
Do While Not zhbiao.EOF
Select Case leave
Case 2
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
s = s + 1
End If
Case 3
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
s = s + 1
End If
Case 4
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot _
And zhbiao.Fields(4).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
choseenum(s, 4) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(4).Value)
s = s + 1
End If
Case 5
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot _
And zhbiao.Fields(4).Value <= sumtot And zhbiao.Fields(5).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
choseenum(s, 5) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(5).Value)
choseenum(s, 4) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(4).Value)
s = s + 1
End If
Case 6
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot _
And zhbiao.Fields(4).Value <= sumtot And zhbiao.Fields(5).Value <= sumtot And zhbiao.Fields(6).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
choseenum(s, 5) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(5).Value)
choseenum(s, 4) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(4).Value)
choseenum(s, 6) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(6).Value)
s = s + 1
End If
Case 7
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot _
And zhbiao.Fields(4).Value <= sumtot And zhbiao.Fields(5).Value <= sumtot And zhbiao.Fields(6).Value <= sumtot And zhbiao.Fields(7).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
choseenum(s, 5) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(5).Value)
choseenum(s, 4) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(4).Value)
choseenum(s, 6) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(6).Value)
choseenum(s, 7) = choice.Adodc1.Recordset.Fields(start - 1 + zhbiao.Fields(7).Value)
s = s + 1
End If
End Select
zhbiao.MoveNext
Loop
End If
End Sub
Public Function max(control As ComboBox) As String
Dim i As Integer
max = Trim(control.List(0))
For i = 1 To control.ListCount - 1
If Val(control.List(i)) > Val(max) Then
max = control.List(i)
End If
Next i
End Function
Public Sub jzuhe(roww As String, start As Integer, leave As Integer)
Dim zhbiao As Recordset
'Set zhbiao = New Recordset
Dim zhcol As Integer
Select Case leave
Case 2
Set zhbiao = hhfcevn.rszuhebiao2
zhcol = 2
Case 3
Set zhbiao = hhfcevn.rszuhebiao3
zhcol = 3
Case 4
Set zhbiao = hhfcevn.rszuhebiao4
zhcol = 4
Case 5
Set zhbiao = hhfcevn.rszuhebiao5
zhcol = 5
Case 6
Set zhbiao = hhfcevn.rszuhebiao6
zhcol = 6
Case 7
Set zhbiao = hhfcevn.rszuhebiao7
zhcol = 7
End Select
choice.Adodc4.Recordset.MoveFirst
choice.Adodc4.Recordset.Find "间隔组='" & roww & "'", , adSearchForward, 1
Dim s As Integer
Dim sumtot As Long
For s = start To 20
If Len(choice.Adodc4.Recordset.Fields(s).Value) = 1 Then
sumtot = Val(choice.Adodc4.Recordset.Fields(s).Value)
Exit For
End If
Next s
If leave = 1 Then
ReDim choseenum(1 To sumtot, 1) As String
For s = 1 To sumtot
choseenum(s, 1) = choice.Adodc4.Recordset.Fields(start - 1 + s)
Next s
Else
Dim z1 As Long
Dim z2 As Long
Dim z3 As Long
z1 = 1
z2 = 1
z3 = 1
For s = 1 To sumtot
z1 = z1 * s
Next s
For s = 1 To leave
z2 = z2 * s
Next s
For s = 1 To sumtot - leave
z3 = z3 * s
Next s
Dim z4 As Long
z4 = z1 / (z2 * z3)
ReDim choseenum(1 To z4, 1 To leave) As String
If zhbiao.State = adStateClosed Then
zhbiao.Open
End If
s = 1
zhbiao.MoveFirst
Do While Not zhbiao.EOF
Select Case leave
Case 2
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
s = s + 1
End If
Case 3
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
s = s + 1
End If
Case 4
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot _
And zhbiao.Fields(4).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
choseenum(s, 4) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(4).Value)
s = s + 1
End If
Case 5
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot _
And zhbiao.Fields(4).Value <= sumtot And zhbiao.Fields(5).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
choseenum(s, 5) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(5).Value)
choseenum(s, 4) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(4).Value)
s = s + 1
End If
Case 6
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot _
And zhbiao.Fields(4).Value <= sumtot And zhbiao.Fields(5).Value <= sumtot And zhbiao.Fields(6).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
choseenum(s, 5) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(5).Value)
choseenum(s, 4) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(4).Value)
choseenum(s, 6) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(6).Value)
s = s + 1
End If
Case 7
If zhbiao.Fields(1).Value <= sumtot And zhbiao.Fields(2).Value <= sumtot And zhbiao.Fields(3).Value <= sumtot _
And zhbiao.Fields(4).Value <= sumtot And zhbiao.Fields(5).Value <= sumtot And zhbiao.Fields(6).Value <= sumtot And zhbiao.Fields(7).Value <= sumtot Then
choseenum(s, 1) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(1).Value)
choseenum(s, 2) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(2).Value)
choseenum(s, 3) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(3).Value)
choseenum(s, 5) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(5).Value)
choseenum(s, 4) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(4).Value)
choseenum(s, 6) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(6).Value)
choseenum(s, 7) = choice.Adodc4.Recordset.Fields(start - 1 + zhbiao.Fields(7).Value)
s = s + 1
End If
End Select
zhbiao.MoveNext
Loop
End If
End Sub
Public Function zuhetotal(cl As Integer, ch As Integer) As Long
Dim i As Integer
Dim stepsum1 As Long
Dim stepsum2 As Long
Dim stepsum3 As Long
stepsum1 = 1
stepsum2 = 1
stepsum3 = 1
For i = 1 To cl
stepsum1 = stepsum1 * i
Next i
For i = 1 To ch
stepsum2 = stepsum2 * i
Next i
For i = 1 To cl - ch
stepsum3 = stepsum3 * i
Next i
zuhetotal = stepsum1 / (stepsum2 * stepsum3)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -