TheresAlwaysAWay
Programmer
Hi- I've searched all forums and YouTube videos searching for a solution. So far, no luck. Hoping someone can help me.
I am creating a means of automatically assigning incoming work to people who are available. The query that generates the list of available personnel is quite complex and takes a couple of seconds to run. That's not a big deal if it only runs once. I've found several solutions online that cause the query to be run once for each record to generate the count. That's obviously impractical with a slow query.
I've found multiple references to the DCount("id","myTable","id <= " & [id]) method, but my problem is that I have no ID number or any number field that is unique. The only unique identifier in the query is a text UserName field, and it seems that the DCount method can't be used with text. At least, I can't get it to work!
What I want in a nutshell is that every time the query is run a sequential number is generated in one field sequencing the records in the order the query displays them. If there are 10 records in the set, the numbers are 1-10 sequentially. If we assume that work has been assigned to one of the users and that person is no longer available, then the next time the query runs the remaining people will be counted 1-9. If two people finish a task and become available it goes 1-11. I need the sequential counter because these people are ordered within the query. Imagine there's an automatic assignment to #1, but s/he is busy and can't take the assignment. The popup message they get contains the ability to deny the assignment, and when they do the automation sees that #1 denied and then reruns the query and sends it to #2. These numbers have a temporary function and need to be regenerated each time the query runs. They are constantly changing but in every case I need to start with 1 in order for it all to come together.
If someone can show me how to use the DCount method with a text field I'll be tickled pink! If someone has a simple VBA solution I'll be jumping up and down. I've literally spent ten hours searching and I just can't come up with something that works in my application.
All help will be greatly appreciated.
I am creating a means of automatically assigning incoming work to people who are available. The query that generates the list of available personnel is quite complex and takes a couple of seconds to run. That's not a big deal if it only runs once. I've found several solutions online that cause the query to be run once for each record to generate the count. That's obviously impractical with a slow query.
I've found multiple references to the DCount("id","myTable","id <= " & [id]) method, but my problem is that I have no ID number or any number field that is unique. The only unique identifier in the query is a text UserName field, and it seems that the DCount method can't be used with text. At least, I can't get it to work!
What I want in a nutshell is that every time the query is run a sequential number is generated in one field sequencing the records in the order the query displays them. If there are 10 records in the set, the numbers are 1-10 sequentially. If we assume that work has been assigned to one of the users and that person is no longer available, then the next time the query runs the remaining people will be counted 1-9. If two people finish a task and become available it goes 1-11. I need the sequential counter because these people are ordered within the query. Imagine there's an automatic assignment to #1, but s/he is busy and can't take the assignment. The popup message they get contains the ability to deny the assignment, and when they do the automation sees that #1 denied and then reruns the query and sends it to #2. These numbers have a temporary function and need to be regenerated each time the query runs. They are constantly changing but in every case I need to start with 1 in order for it all to come together.
If someone can show me how to use the DCount method with a text field I'll be tickled pink! If someone has a simple VBA solution I'll be jumping up and down. I've literally spent ten hours searching and I just can't come up with something that works in my application.
All help will be greatly appreciated.