G
Guest
I have been using the code below to distribute records in a round robin
fashion to 3 different lists in access. I now need to add a fourth list but
cannot get the code to work. 'Queue' or 'Q' refers to the list that each
record will be routed to. Can anyone help?
Private Function SetQueueRouting()
'-- Added 12/12/2004
'--Sets queue_key field to the queue that was not routed to the last two deals
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim temp As Integer
Dim MyQ As Integer
Set db = CurrentDb
'Opens recordset based on query 'qryGetLast2QueueRoutings' to get last 2
queue routings
Set rs = db.OpenRecordset("SELECT Queue_Key FROM qryGetLast2QueueRoutings")
'Reads and concatenates last 2 Q routings into temp variable
rs.MoveFirst
temp = rs!Queue_Key 'read first Q routing into variable
rs.MoveNext
temp = temp & rs!Queue_Key 'read second Q routing into same variable
rs.MoveNext
temp = temp & rs!Queue_Key 'added for addition of 4th queue in round robin
11/26/05
If Me.Input05 = "RT14" Then 'If new record is a "system error" request type
then route to Q2
MyQ = 2
Else 'else set variable to whatever Q was not used in the last 2 Q routings
Select Case temp
Case 13, 31
MyQ = 4
Case 14, 41
MyQ = 3
Case 34, 43
MyQ = 1
'added q6 w/ randomly picked numbers 11/26/05
Case 57, 75
MyQ = 6
Case 11
MyQ = 3
Case 33
MyQ = 4
Case 44
MyQ = 1
Case 55
MyQ = 6
'q6 added on 11/26/05
End Select
End If
'set the function value to the chosen Q
SetQueueRouting = MyQ
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End Function
fashion to 3 different lists in access. I now need to add a fourth list but
cannot get the code to work. 'Queue' or 'Q' refers to the list that each
record will be routed to. Can anyone help?
Private Function SetQueueRouting()
'-- Added 12/12/2004
'--Sets queue_key field to the queue that was not routed to the last two deals
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim temp As Integer
Dim MyQ As Integer
Set db = CurrentDb
'Opens recordset based on query 'qryGetLast2QueueRoutings' to get last 2
queue routings
Set rs = db.OpenRecordset("SELECT Queue_Key FROM qryGetLast2QueueRoutings")
'Reads and concatenates last 2 Q routings into temp variable
rs.MoveFirst
temp = rs!Queue_Key 'read first Q routing into variable
rs.MoveNext
temp = temp & rs!Queue_Key 'read second Q routing into same variable
rs.MoveNext
temp = temp & rs!Queue_Key 'added for addition of 4th queue in round robin
11/26/05
If Me.Input05 = "RT14" Then 'If new record is a "system error" request type
then route to Q2
MyQ = 2
Else 'else set variable to whatever Q was not used in the last 2 Q routings
Select Case temp
Case 13, 31
MyQ = 4
Case 14, 41
MyQ = 3
Case 34, 43
MyQ = 1
'added q6 w/ randomly picked numbers 11/26/05
Case 57, 75
MyQ = 6
Case 11
MyQ = 3
Case 33
MyQ = 4
Case 44
MyQ = 1
Case 55
MyQ = 6
'q6 added on 11/26/05
End Select
End If
'set the function value to the chosen Q
SetQueueRouting = MyQ
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
End Function