khurram7x - please note that the discussion between MajP and me is not meant to discourage you. We are both seeking a way to improve the performance issue that you describe. But as is common with technically oriented people, we sometimes disagree on the approach that would work best, and our problem is that it is not clear what ELSE is done when you directly change the .Recordset property of that control.
...
My concern is whether changing the control's .Recordset, which transparently changes the .Rowsource, would do an automatic .Requery and thus "waste" the Async operation, which would leave you right where you were in terms of speed issues.
Thanks to your guys for very fine details. I understand you're all trying to help me.
Just to be clear, this is an unbounded form and Record Source is not available. This forms opens in response to a selection of a combo on another form. I've not used .RecordSet anywhere in the code yet for this form, and I'll try once it is clear in our discussion about what is going to work best for me.
I mentioned that changing back-end to SQL Server has not changed anything the way code worked with JET Db, so we're quite safe to assume that it'll not re-query even if back-end if SQL Server.
...The way I populated the combo boxes was that I did not care whether they would get anything back if they overqualified the query. They just selected one value from a list of commonly found choices. And sometimes it happened that they would get no results. But I never did more than one query of the main table, which included literally a quarter of a million entries.
Minty also expressed some concern about the time you say this takes. If you could describe a bit more about WHAT you are selecting with each combo box, perhaps we might be able to offer thoughts on a different setup that doesn't require so many queries. And let's face it - your problem IS that you have so many queries to run that you want to minimize the time they take.
I actually did similar think earlier where query would not run until you hit 'Search' button, but I was told that we need to minimize the search at each selection to matching one's only so that someone will not selecte unmatched option and not return any result. If wrong selection is made, and no result is returned, Supervisor will not have any equipment to report progress against.
I've uploaded another screenshot at google drive, did share above and tried to describe on an image what is required, or actually happening, in my case.
I'm posting link again here. It also contains the text file which has the code for selection parameter form. From there you'll pick up what I'm trying to do in code, and you'll be able to suggest what is the best solution for me.
https://drive.google.com/open?id=15MTzVgUeVPqQQQ9RXRUNWUyiX2qVXUYc
@The_Doc_Man
...@khurram7x
You probably realized that ADODB and ADO.Net are two completely different animals. ADO.Net is very powerful in what it can do. Take a look at some of the ADO.Net capabilities to do asynchronous processes
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/asynchronous-programming...
Thanks. I've saved in my favorites and certainly will spend time on it.
...
My general thoughts on this topic:
If the performance of some queries is bad, then fix the issue by making the queries run faster and/or by running the queries less often.
In most cases, introducing async operations, while making things much more complex, will only cure (some of) the symptoms but not the disease.
I'm applying a condition which will not allow to run query against a combo which is disabled (I've explained disabled combox in screenshot I've discussed above) due to no matching data in disabled combo for selected item.
I've indexed the queries but all of them are text field, which still makes it slow as database grows.
My reason on being Async query was, we've parallel application in Android and it also started working slow at some point recently. We went back to Android developers and they fixed the issue by using Async queries and cutting some queries short, which is another topic. Developer told me that he has created 15 functions, one for each combo query, and a main function which calls to those 15 functions. Java compiler then run all those Async queries together. This does not keep the program on wait until all queries finish running, and they populate the combo RowSource quietly in the back ground. This has increased the speed of Android version of the program to very fast and responding, and this is what I'm also trying to implement in Access unless there's a better suggestion.
So is it possible to get this done on similar lines in Access, to let 15 Async queries run together in background while program does not wait finishing their execution?
I know all combos will not populate at once like this, but program will be responding at the least, and since queries are fast and indexed, they should be able to respond before someone could take the mouse there and click!
Plus, does the Async query also works in a similar fashion as OpenRecordSet... i mean in a record by record traversal of full table, of each and every record? like Cursors in SQL Server?
Where does the resultant query gets stored?
How should I give the RowSource to combo?
I've run the following query, which runs successfully but not understanding how to set RowSource for combo?
Set cmd = New ADODB.Command
With cmd
.ActiveConnection = CurrentProject.Connection
.CommandText = "SELECT DISTINCT tblBoQ.TagNo " & SqlWhere & ParaWhere & " AND tblBoQ.TagNo IS NOT NULL"
.CommandType = adCmdText
.Execute adAsyncExecute
End With