The quickest and easiest may be to simply use the randomNumber code I showed earlier.
I created another function, that uses the randomNumber function. It requires 2 parameters.
These are:
TotalAppraisersForCounty-- a number represent the total appraisers in the County you're working on
TotalOrderForCountyNotAssigned--Number of Orders for the County not Yet assigned
You put these numbers into a rouine and it will print out which appraiser gets the Orders.
This is the code:
Code:
Function AssignAppraisersRandomly(TotalAppraisersForCounty As Long, TotalOrderForCountyNotAssigned As Long) As String
Dim a As Long 'always 1 first Appraiser for County
'TotalAppraisersForCounty is total appraisers for this county
Dim i As Integer
Dim tmp As String
10 a = 1
30 For i = 1 To TotalOrderForCountyNotAssigned 'the number of OrderJob for this County not already assigned
40 tmp = tmp & randomNumber(a, TotalAppraisersForCounty) & ", "
50 Next i
60 AssignAppraisersRandomly = Mid(tmp, 1, Len(tmp) - 2)
End Function
And here is a test/sample for demonstration.
Code:
Sub testAssigningAppraisersToJobs()
Dim totApprsForCounty As Long 'this represents the number of Appraisers for this county
Dim totOrdersForCounty As Long 'this represents the number of Orders for this county not yet assigned
totApprsForCounty = 5 '<---example with 5 appraisers for this county
totOrdersForCounty = 3 '<---example with 3 jobs for this county notyet assigned
'
'So you need to assign appraissers to 3 jobs randomly from the 5 appraisers
'
'This next line displays the appraisers to be assigned based on the Orders in your table
Debug.Print AssignAppraisersRandomly(totApprsForCounty, totOrdersForCounty)
End Sub
I ran this procedure a number of times to see the random results.
Here are the results:
Code:
1, 3, 2
4, 3, 4
3, 3, 4
4, 4, 1
4, 5, 2
4, 2, 3
3, 3, 5
2, 1, 4
Looking at the first result 1,3,2 means you assign
Appraiser 1 to first Job/Order
Appraiser 3 to the second Job/Order
Appraiser 2 to the third Job/Order
You could use a Form with 2 text boxes or 2 combos. These would be for the Number of Appraisers and the Number of Jobs respectively. With text boxes you would enter the numbers; with combos you could select values from the combo. In either case the just represent the number of Appraisers for the county, and the number of Jobs for the county. You push a button and it calls the function behind the scenes and displays the output in another textbox or message.
You would update your tables as shown above. You can certainly get more sophisticated with more programming.
But this would probably handle quick and easy.
Good luck.
-