Data Access Page with vbscript to route records

C

Christaaay

I am using a Data Access Page to enter records into an Access Database. A
peice of code automatically assigns a 'queue' or 'list' number to organize
the records for work. I just added an additional list to the database but am
having trouble updating the code in the Data Access Page to also reflect this
new list. Any idea how to get the code to recognize an additional list (#6)
when entering a new record?

Here's the existing code in the Data Access Page and below is the code after
it was updated in the database itself.

Function FetchQueueValue()

Set rs = CreateObject("ADODB.Recordset")
sqlSelect = "SELECT * FROM DAPqry_GetLast2QueueRoutings"
rs.Open sqlSelect, MSODSC.Connection
rs.MoveFirst
temp = rs.fields.item("Queue_Key").value
rs.MoveNext
temp = temp & rs.fields.item("Queue_Key").value
rs.close
set rs = nothing
Select Case temp
Case "13", "31"
FetchQueueValue = 4
Case "14", "41"
FetchQueueValue = 3
Case "34", "43"
FetchQueueValue = 1
Case "11"
FetchQueueValue = 3
Case "33"
FetchQueueValue = 4
Case "44"
FetchQueueValue = 1
End Select

End Function


here's the code in the database:

Static n As Integer
Do
temp = Left(temp, 4) 'only last 4 queues
n = n Mod 6
n = n + 1 'queues 1 to 6
If n = 2 Then n = n + 1 'don't use queue 2 (system issues queue)
If n = 5 Then n = n + 1 'don't use queue 5 (Mgr queue)
If 0 = InStr(temp, n) Then
MyQ = n
Exit Do
End If
Loop
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top