Public Function FUN_TO_CHILDREN(STR_NUMBER_CARD As String) As Integer
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "SELECT CLIENT_CARDS_TBL.* " _
& " From CLIENT_CARDS_TBL " _
& " Where (((CLIENT_CARDS_TBL.PARENT_CARD) = '" & STR_NUMBER_CARD & "'))", GLB_CONNECTION, adOpenKeyset, adLockOptimistic
rst.MoveLast
rst.MoveFirst
Do While rst.EOF = False
GLB_GROUP_TURN = GLB_GROUP_TURN + FUN_PERSONAL_TURN(rst("NUMBER_CARD"))
STR_NUMBER_CARD = rst("NUMBER_CARD")
' возможно это уменьшит время выполнения - хотя спорный вариант
' нужно запустить с 2-мя вариантами на большом количестве и посмотреть
rst_1.Open "SELECT CLIENT_CARDS_TBL.* " _
& " From CLIENT_CARDS_TBL " _
& " Where (((CLIENT_CARDS_TBL.PARENT_CARD) = '" & STR_NUMBER_CARD & "'))", GLB_CONNECTION, adOpenKeyset, adLockOptimistic
if rst_1.eof=false then FUN_TO_CHILDREN (STR_NUMBER_CARD)
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
End Function
|